cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ejaz
Advocate I
Advocate I

Updating option set value in CDS entity from Forms response

Hi all,

 

OK so I'm trying to update a custom field that uses an option set, with values from Forms Pro survey. The issue is that I can't find a way of easily validating the question response with the option set values and then updating the field in the CDS entity.

 

The survey is collecting diversity and inclusion information so as an example below, I'm picking up the question response about religion, then seeing if 'Christianity' matches an option set value. If YES than I return the integer value of the option set so my custom field will show the value 'Christianity' . if NO, then I have to put another IF statement to check the next option set value and so on until it will match; 

if(equals(outputs('Get_response_details')?['body/r4aedfddf1a4c46498eae71eb58561f26'], 'Christianity'), '100000007', <<ANOTHER IF STATEMENT>>'))

 

So, is there a better way to do this? I will also have to repeat this for each question response that i want to update in the CDS

 

1 ACCEPTED SOLUTION

Accepted Solutions

@Ejaz 

 

Here is an example:

4.JPG

In the above example, In the switch action, I am checking First Name.

If First Name = David, then setting variable varEmployeeID = 101

If First Name = Smith, then setting variable varEmployeeID = 102

If First Name does not match with any defined values, then setting variable varEmployeeID = 000

 

In your case, the field related to outputs('Get_response_details')?['body/r4aedfddf1a4c46498eae71eb58561f26']  will go into Switch ON field. I am calling your field as Religion (no offense).

If Religion = Christianity, then set variable varReligionID = 100000007

If Religion = X, then set variable varRegionID = 100000008

Repeat how many ever conditions you have like this..

 

Regards

Krishna Rachakonda

If my reply helped you solving the issue, please mark the reply as Accepted Solution.

 

 

View solution in original post

5 REPLIES 5
rsaikrishna
Dual Super User
Dual Super User

@Ejaz 

 

Instead of placing multiple nested IF statements, it is better to use SWITCH action.

2.JPG

 

Please give a try and let me know if you have any questions.

 

Regards

Krishna Rachakonda

If my reply helped you solving the issue, please mark the reply as Accepted Solution.

thanks! can you give me an example of how I would use that in this scenario?

@Ejaz 

 

Here is an example:

4.JPG

In the above example, In the switch action, I am checking First Name.

If First Name = David, then setting variable varEmployeeID = 101

If First Name = Smith, then setting variable varEmployeeID = 102

If First Name does not match with any defined values, then setting variable varEmployeeID = 000

 

In your case, the field related to outputs('Get_response_details')?['body/r4aedfddf1a4c46498eae71eb58561f26']  will go into Switch ON field. I am calling your field as Religion (no offense).

If Religion = Christianity, then set variable varReligionID = 100000007

If Religion = X, then set variable varRegionID = 100000008

Repeat how many ever conditions you have like this..

 

Regards

Krishna Rachakonda

If my reply helped you solving the issue, please mark the reply as Accepted Solution.

 

 

View solution in original post

This is great, thanks! I will try this. 

@Ejaz 

 

Felt happy that my last reply helped you in resolving the issue.

 

Can you please mark my last reply as Accepted Solution? So that, other users can this post when they search for solution.

 

Regards

Krishna Rachakonda

If my reply helped you solving the issue, please mark the reply as Accepted Solution.

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,339)