Error updating person group field using "Send Http Action" in flow - sharepoint-online

I am trying to update person/group column using power automate . I am getting below error
An unexpected 'PrimitiveValue' node was found when reading from the JSON reader. A 'StartObject' node was expected.
clientRequestId: bbf41a14-51dd-4cd0-8ac8-67313f4cf6a5
serviceRequestId: 539c869f-a0d9-b000-66c0-1ac6d790fbd9
I am able to successfully retrieve the user ID but the update fails.
{
'__metadata': { 'type': 'SP.Data.Partner_x0020_Training_x0020_RegistrationListItem' },
'RegisteredByStringId': '[#{variables('UserID')}]'
}
When i query using link below, the results for my
"RegisteredBy" column are as below
https://siteurl/Business%20Development/_api/web/lists/getbytitle('Partner%20Training%20Registration%20Hub')/items(96)
Business%20Development/_api/web/lists/getbytitle('Partner%20Training%20Registration%20Hub')/items(96)
<d:RegisteredById m:null="true" /><d:RegisteredByStringId m:null="true" />
TRied using both these column names but no luck.
Article reference
https://www.about365.nl/2018/08/06/updating-a-multi-people-field-in-sharepoint-with-microsoft-flow/

Related

QueryFailedError: missing FROM-clause entry for table "users" nestjs-paginate

I'm facing issue related to postgres nestjs-paginate query in which filtering column through relation. I have one table projects and projects has relation with users(MANY TO MANY).
I want to filter users.name using project table.
Please check these code of lines i added:
return paginate(query, this.projectRepository, {
sortableColumns: ['createdOn'],
nullSort: 'last',
defaultSortBy: [['createdOn', 'DESC']],
filterableColumns: {
name: [FilterOperator.EQ, FilterOperator.NOT, FilterOperator.ILIKE],
team: [FilterOperator.EQ, FilterOperator.NOT, FilterOperator.ILIKE],
'users.name': [FilterOperator.EQ,FilterOperator.NOT, FilterOperator.ILIKE],
createdOn: [FilterOperator.EQ, FilterOperator.NOT, FilterOperator.GT, FilterOperator.LT, FilterOperator.BTW]
},
relations: ['users']
});
In filterable column managed users.name, Every filter for this column working $eq,$not,$ilike but when i'm trying to hit: filter.users.name:$not:$ilike:aarti. I'm facing this issue:
[Nest] 126036 - 30/01/2023, 20:15:59 ERROR [ExceptionsHandler] missing FROM-clause entry for table "users"
QueryFailedError: missing FROM-clause entry for table "users"
I'm not able to figure out because i already added the relations tag in specific function.Basically multi operators is not working together. Please suggest some idea what i'm doing wrong.

custom columns with custom headings and fields in tabulator

I'm trying to create the ability to add custom columns to a tabulator table.
I have a db table where I have a title and field. I extract that info into a json and want that to be added to my table.
fetch("../includes/getCustomColumns.php")
.then(function(response) {
return response.json()
}).then(function(returned) {
window.customColumns = returned
console.log(window.customColumns)
})
Then in my table I have
{
title : "Custom Columns",
columns: [
window.customColumns,
],
}
But I get
Uncaught (in promise) TypeError: Cannot read property 'field' of undefined and tabulator.min.js:2 Invalid column definition option in 'undefined' column: ..
I can see the two columns in the console log and if I copy that into the table it works. I'm wondering if it ss it even possible to add customisable columns to Tabulator or am I simply on the wrong track.
without seeing the code more specifically than what you have here, I'm going to guess that because the fetch() is asynchronous, that window.customColumns is still undefined when you are creating the Tabulator. And then "sometime later" your fetch() sets the value, but it's too late.
You could use addColumn() to programatically add the response to your fetch() when it is received.

How to update array in object in an array with index in mongoose?

I am developing an application using MongoDB and express.
the application is similar to any social media app, the user can create posts and the other users can like the post and also comment on it.
I want to add a feature where a user can like the comment and I've tried a lot and searched too but with no good results.
the json format of a post object:
{
...,
comments: [
{
title: 'I am a comment in the post !',
likers: [
ObjectId('foo'),
ObjectId('bar'),
],
},
],
}
I want to either be able to push to likers or pull from with index.
I have tried to update using the following code but I failed since it cant read the commentIndex property and gives error in syntax.
Post.findByIdAndUpdate(postId , { '$push': { 'comments.${commentIndex}.likedUsersIds': mongoose.Types.ObjectId(liker) } })
also tried with operator $ and not worked too.
please help me.
Thanks,

How to autogenerate id if there is no id in document with elasticjs v5.0

I am trying to add documents, according to elastic search documents, we can add document, even if we dont provide id... See Here
I am trying to add a document even if it doesnt have any ID. in elastic search, how can i do that?
My current code looks like this
var params = _.defaults({}, {
index: index,
type: type, //'customer'
id: data.id || null,
body: data
})
debug(params)
return this.client.create(params);
The above code gives this error
{
"error": "Unable to build a path with those params. Supply at least index, type, id"
}
Any hint would help, thanks
With the create call you MUST provide an id.
If you are not sure if an ID will be present in your data , then you can use the client.index() function instead. using that function, ES will auto-generate an ID if none is provided.

NetSuite SuiteScript 2.0 getSelectOptions filter breaks setValue

I am dumbfounded on what is happening and hoping someone can help me figure out what is happening. I am using SuiteScript 2.0 and to find the internal id's of dynamic fields I am doing:
var location = saleRec.getField({
fieldId: 'location'
}).getSelectOptions({
filter: "Test Location",
operator: 'is'
});
This returns the internal ID I need but when I try to call:
saleRec.setValue({
fieldId: 'location',
value: location[0].value
});
I get an error:
{
"error": {
"code": "JS_EXCEPTION",
"message": "{\"type\":\"error.SuiteScriptError\",\"name\":\"INVALID_FLD_VALUE\",\"message\":\"You have entered an Invalid Field Value 2 for the following field: location\",\"stack\":[\"anonymous(N/recordService)\",\"doPost(SuiteScripts/DemoProject/RESTlet1.js:124)\"],\"cause\":{\"type\":\"internal error\",\"code\":\"INVALID_FLD_VALUE\",\"details\":\"You have entered an Invalid Field Value 2 for the following field: location\",\"userEvent\":null,\"stackTrace\":[\"anonymous(N/recordService)\",\"doPost(SuiteScripts/DemoProject/RESTlet1.js:124)\"]},\"id\":\"\"}"
}
}
The number 2 is definitely the internal ID I need. But it starts to get weird. If I remove the filter and just call:
var location = saleRec.getField({
fieldId: 'location'
}).getSelectOptions();
And then loop through the array of results and select the proper internal id I need everything works fine and it is able to set the internal id of location. It seems like the filter is removing it from the location select field or something strange like that but I can't imagine that is the intended purpose of the filter. Is this a bug or am I using it wrong?
Just a hunch, try running again
.getSelectOptions({filter: "Test Location",operator: 'is'}).
Then after getting the value
.getSelectOptions();
It seems like a bug, where the data object holding the available values is left filtered.

Resources