cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lalit_Kadam
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
v-siky-msft
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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (57,273)