cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper III
Helper III

multiple records update for CDS entity

Hi ,

I am trying to update multiple  CDS entity record using ForAll and Path and Lookup function.

I also tried with path function but its showing "Invalid argument type error"
Same code is working with SharePoint list but not with CDS entity.


Used below code updateif (Fuction):-
ForAll(ReassignUserCollection6,UpdateIf(ChemicalOrders,ChemicalOrderID="1", {OrderNumber:"order1"}))

used below code with Patch function:-
ForAll([RenameColumns(Filter(ReassignUserCollection6,IsChoosen=true),"crb05_chemical_id","crb05_chemical_id_new")], Patch(ChemicalOrders,LookUp(ChemicalOrders,Chemical_ID=crb05_chemical_id_new),{ OwnerID: "1"}))


Regards,
Lalit Kadam

7 REPLIES 7
Community Support
Community Support

Hi @Lalit_Kadam ,

Modify the code:

ForAll([RenameColumns(Filter(ReassignUserCollection6,IsChoosen=true),"crb05_chemical_id","crb05_chemical_id_new")], Patch(ChemicalOrders,LookUp(ChemicalOrders,Chemical_ID=crb05_chemical_id_new),{ OwnerID: "1"}))

to

ForAll(RenameColumns(Filter(ReassignUserCollection6,IsChoosen=true),"crb05_chemical_id","crb05_chemical_id_new"), Patch(ChemicalOrders,LookUp(ChemicalOrders,'Chemical_ID'='crb05_chemical_id_new'),{ OwnerID: "1"}))

Or 

UpdateIf( ChemicalOrders, 'Chemical_ID' in ReassignUserCollection6.'crb05_chemical_id', { OwnerID: "1"})

 

Hope this helps.

Sik

Hi Sik,

 

Thanks  for quick reply.

 

I tried both code but it is still showing same error again. Please refer attached screen shot.

Regards,

Lalit Kadam

Hi @Lalit_Kadam ,

The error shows the entity name ChemicalOrders is invalid.

Please check it in the left Data source panel.

Sik

Hi Sik,

 

The "chemicalOrders" entity is exists. Please find attached screen shot.

Regards,

Lalit Kadam

Hi @Lalit_Kadam ,

 

There is no need to use ForAll function. Just try to use UpdateIf function alone.

 

UpdateIf( ChemicalOrders, 'Chemical_ID' in ReassignUserCollection6.'crb05_chemical_id', { OwnerID: "1"})

Sik

Hi sik,

I have to update selected record from gallery. updateif function only updating single record from selected list. therefore I am trying with ForAll function.

Regards,

Lalit Kadam

Hi @Lalit_Kadam ,

 

I don't agree with you.

UpdateIf function can modify one or more records that match the condition ( 'Chemical_ID' in ReassignUserCollection6.'crb05_chemical_id')

Please check: UpdateIf function 

 

Sik

Helpful resources

Announcements
secondImage

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Top Solution Authors
Top Kudoed Authors
Users online (9,050)