Forum Discussion
john john
Jul 30, 2019Iron Contributor
Exception calling "ExecuteQuery" with "0" argument(s): "The node to be inserted is from a different
Last week i was able to hide 2 site columns from New list form using this PnP script (the fields were of type Single line of text and Date/Time):- $User = "admin@****.onmicrosoft.com" $SiteURL =...
paulpascha
Jul 31, 2019Bronze Contributor
Could you try to see what happens if you separate the changes of SetShowInEditForm and SetShowInNewForm? Changing your code as follows:
$customfield.SetShowInEditForm($true)
$customfield.UpdateAndPushChanges($true)
$Context.ExecuteQuery()
$customfield.SetShowInNewForm($false)
$customfield.UpdateAndPushChanges($true)
$Context.ExecuteQuery()
$customfield.SetShowInEditForm($true)
$customfield.UpdateAndPushChanges($true)
$Context.ExecuteQuery()
$customfield.SetShowInNewForm($false)
$customfield.UpdateAndPushChanges($true)
$Context.ExecuteQuery()
john john
Jul 31, 2019Iron Contributor
paulpaschayes this worked for me!! not sure what is going on? any idea?
- paulpaschaJul 31, 2019Bronze ContributorI don't know exactly what's going on, but I can imagine executing both operations in a single call to executequery results in some kind of conflict internally.