Is it possible to change Wrap Strategy programmatically? I've already tried with
batch_update_spreadsheet documentation
service.batch_update_spreadsheet
and
stackoverflow question
batch_update
but neither worked.
It always return Invalid Request.
My request, as I understand from here, is just
service.batch_update_spreadsheet([{ 'wrapStrategy': 'WRAP' }])
What am I doing wrong? I want to change all cells from my sheet.
Thanks
From service.batch_update_spreadsheet([{ 'wrapStrategy': 'WRAP' }]) and I want to change all cells from my sheet., I guessed that your goal is as follows.
You want to reflect 'wrapStrategy': 'WRAP' to a sheet in a Google Spreadsheet using googleapis for ruby.
You have already been able to get and put values to Google Spreadsheet with Sheets API.
In this case, how about the following sample script?
Sample script:
spreadsheet_id = '###' # Please set your Spreadsheet ID.
sheet_id = '###' # Please set your sheet ID.
request_body = {
requests: [{repeat_cell: {
range: {
sheet_id: sheet_id,
},
cell: {
user_entered_format: {
wrap_strategy: 'WRAP'
}
},
fields: 'userEnteredFormat.wrapStrategy'
}}]
}
service.batch_update_spreadsheet(spreadsheet_id, request_body, {})
When this script is run, the wrapStrategy of sheet_id is set as WRAP.
In this case, please use the snake case for the keys instead of the camel case. Please be careful about this.
Note:
In this sample script, it supposes that your client of service can be used for updating the spreadsheet. Please be careful about this.
References:
Method: spreadsheets.batchUpdate
RepeatCellRequest
Related
I am using below scripts to get the reference entity from email entity. When the scripts was triggered, it prompts 'Could not find a property named 'new_queue' on type 'Microsoft.Dynamics.CRM.email''.
The reference entity's scheme name is new_queue, and I think the structure of the script is same as the guidance of microsoft knowledge article.
(https://learn.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-webapi/retrieverecord)
Can anybody point out what's wrong here?
Xrm.WebApi.retrieveRecord("email", '4884f79f-42f3-ea11-a815-000d3a44afcc', "?$select=subject&$expand=new_queue($select=queueid,name)").then(
function success(result) {
var toLookup = new Array();
toLookup[0] = new Object();
toLookup[0].id = result.queueid;
toLookup[0].entityType = "queue";
toLookup[0].name = result.name;
alert(result.name);
}, function (error) {
Xrm.Utility.alertDialog(error.message);
});
This issue is usually an outcome of case sensitive schema name, try new_Queue instead of new_queue. You can always verify this by checking in xml metadata.
Update:
I remember that the activity (email, task, appointment, etc) is special and little different. Make sure you download the metadata xml from Developer resources and check the correct navigation property. It should look like email_new_queue or new_queue_email
To know the correct navigation property name to use it in $expand:
Request the "Email" entity and Include the following header Prefer: odata.include-annotations="*".
In the response, you should find a field that looks something like:
"_new_queue_value#Microsoft.Dynamics.CRM.associatednavigationproperty": "????"
Use the name you'll find in the place of "????" in the $expand expression.
I have made dynamic pages for my recipes in Wix and I had an user form for feedback in the dynamic pages , I'm able to get the feedback but can't able to know for which item they are ?
I want to get the title of recipe along with the user feedback into
my database.
Please help me solve it.
You can get information from the Dynamic Dataset like this:
var myVariable;
$w("#dynamicDataset").onReady( () => {
let itemObj = $w("#dynamicDataset").getCurrentItem();
myVariable = itemObj.fieldKey; //get the relevant field key
});
After this you can submit the data using the Wix Data API. Just make sure to pass on the myVariable so that you know where the submission came from. Sample code below.
let data = {
fieldKey1: randomVariable,
fieldKey2: someVariable,
pageInfo: myVariable
}
wixData.insert('collectionName', data);
Read more about dynamic dataset's getCurrentItem() function here: https://www.wix.com/corvid/reference/wix-dataset.DynamicDataset.html#getCurrentItem
Also, the submission has to go through using the Wix Data API's insert() function. Read about it here: https://www.wix.com/corvid/reference/wix-data.html#insert
I'm creating a model that I will use to authenticate users for API access, and I have a secret field where I want to store a Base64 encoded uuid/v4 generated value.
I went through the different field types and options, but still not seeing how I could achieve this.
Is there a way to hook in model instance creation, and set the value of my secret field ?
Yes, you can use the pre hooks.
In your situation, the basics would be:
AuthenticationModel.schema.pre("save", function(next) {
const secretValue = generateSecretValue();
this.secret = secretValue;
next();
});
That would go before your final AuthenticationModel.register(); in your model.js file.
This is how I set it up, also with the pre-save hook. My problem before was that I was getting the same random number again until I restarted the server.
Store.schema.pre('save', function (next) {
if (!this.updateId && this.isNew) {
// generates a random ID when the item is created
this.updateId = Math.random().toString(36).slice(-8);
}
next();
});
Using this.isNew was also useful in my case.
I'm just starting with Parse (developing with Corona SDK). I've had no problems with basic usage such as getting and uploading data, authenticating users etc.
I have had some trouble getting my head around Cloud Code though.
Here's what I'm after:
My User class has an array column called exclude. For each user it contains some objectId's of objects stored in another class called questions. On request, I would like Parse to return all questions whose objectId's are NOT inside current user's exclude array.
I could do it without cloud code, by just downloading the whole questions class content and filtering it on device, but I thought it would be more efficient to do it server-side.
So is this achievable via Cloud Code? Do you know any examples I could look at to understand how to do it?
Edit: I've tried this function. It does not return anything. (exclude has been changed to doneQuestions)
Parse.Cloud.define("getQuestions", function(request, response) {
var query = new Parse.query("Questions");
query.notContainedIn("objectId", user["doneQuestions"]);
query.find({
success: function(objects) {
console.log();
},
error: function(error) {
console.log("An error occured :(");
}
});
});
You can use the notContainedIn constraint:
query.notContainedIn("objectId", user["exclude"]);
I am having an issue with the card token not saving against a customer using the Ruby Stripe integration and Stripe.js
We get what looks to be a valid card token from Stripe.js (e.g. tok_4VeYrrjJpCwGG6)
Then I am calling the following;
customer = Stripe::Customer.retrieve(customer_id) #customer_id is correct and valid
customer.card = stripeToken # e.g. the tok_ I gave as an example
customer.save
If I log out the result of customer.save I get something like;
{
"id":"cus_4QR8ZuPUPlgA0G",
"object":"customer",
"created":1405685697,
"livemode":false,
"description":null,
"email":"my_email",
"delinquent":true,
"metadata":{},
"subscriptions": {
"object":"list",
"total_count":0,
"has_more":false,
"url":"/v1/customers/cus_4QR8ZuPUPlgA0G/subscriptions",
"data":[],
"count":0
},
"discount":null,
"account_balance":0,
"currency":"eur",
"cards"{
"object":"list",
"total_count":0,
"has_more":false,
"url":"/v1/customers/cus_4QR8ZuPUPlgA0G/cards",
"data":[],
"count":0
},
"default_card":null,
"subscription":null
}
Everything is as I would expect bar the card hasn't been added.
Could anyone advise what I am possibly doing wrong here?
To add a new card to an already existing customer you have to make use of the create card API call. Please take a look at https://stripe.com/docs/api/ruby#create_card for details on how to go about this.
In your particular case, you can update the user with:
customer = Stripe::Customer.retrieve(customer_id)
customer.sources.create(:source => stripeToken)
Let me know if that helps solve your problem.