It’s possible to get related records of a relationship when we retrieve a parent record using RelatedEntitiesQuery property in the RetrieveRequest. That means you have to construct the RetrieveRequest not using the Retrieve method from the OrganizationServiceProxy class.
Recently we had a requirement to implement an approval workflow when a document is added to a SharePoint library.
Below is how we can implement it.
Details –
Trigger – When a file is created (properties only)
Specify the Site Address, Library Name, and the Folder on which the flow should run.
Initialize Variable
Initialize a variable VarComments to save all the responses.
Start and wait for an approval
Here we have used the Approval type as Custom Response – Wait for one response, we could also Approve / Reject – First to respond or any approval type based on the requirements.
The Assigned to field contains the name of the user who needs to review it.
The item link contains the link to the item.
Enable reassignment as Yes will allow the approver to reassign the approval to another user from the Approval Center.
Apply to each
Append the approval response to the variable VarComments.
Condition
If Outcome is Approved
If Yes – Update File Properties
Update the properties of the file using the ID.
Update the Approval Comments property with the variable.
Suppose we have 3 tables, Table A, Table B, and Table C related to each other as
Table A (n-1) Table B (n-1) Table C i.e.
Table A has a lookup of Table B and Table B has a lookup of Table C.
Below is our sample canvas app that has a gallery and a combo box.
What we would want is based on the Table C record’s name selected in the combo box, we want to filter the collection to only show those records that are related to it.
One of the ways we could implement this is by using the AddColumns to add Table C data to Table A and apply the Filter to it.
Below is the formula to achieve the same.
In Table A, add a column name “TableCName”.
To get the Table C name, perform a Lookup on Table B, where Table B GUID is equal to Table A’s Table B lookup field, and then fetch the Table C Lookup’s name from Table B.
And lastly, perform a Filter on this new column TableCName, based on the selected value in the combo box.
One of the reasons why throwing the InvalidPluginExecutionException doesn’t show up error dialog could be that you would have Profiled that step with profile storage as Persist to Entity.
Stop Profiling and it should work as expected.
Check for more details on InvalidPluginExecutionException –