Today i am going to share my experience on how to update a invoice record where the option set field value needs to be updated in the lookup field on same invoice entity.
Scenario: Requirement to remove the Option set field and before that happens that option set value should be updated in the Lookup field which have same string value. The purpose of it is to do bulk update of all invoice records with business unit lookup value.
Lets gets started.
Login into Power Automate here
First choose manual trigger flow.
Then initialize variable "department" and choose Type as "string".
Then select "List rows" which is for list invoices.
In the table name column choose "Invoices" and in the filter rows paste the "schema name" of the business unit field not equal to null from the invoice.
As the business unit field is already exists in the invoice table, the purpose of this flow is o update the invoices records, copy the values from the department "option set" field value and update in business unit lookup field.
Once that's done, choose the "apply to each" and then "set a variable" with the "department" which we already initalize before and the
set the value field from the "Expressions" with value: items('Apply_to_each')?['gmr_department@OData.Community.Display.V1.FormattedValue']
Then choose the List rows: List business units
select the Business units on the table name field, and filter rows by name eq "variables('Department')".
Then choose another "Apply to choose 2", create a update rows - "Update Invoices"
Table name: Invoices and row ID equal : items('Apply_to_each')?['invoiceid']
and business unit field with - items('Apply_to_each_2')?['businessunitid']
Finally save the flow and test it and all the invoices will be updated on business unit field.
I hope this helps.
Malla Reddy(@UK365GUY)
#365BlogPostsin365Days
No comments:
Post a Comment
Note: only a member of this blog may post a comment.