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

How to set option set value based on the value getting from text field using plugin?

Hello everyone, 

 

I have two fields in my table

1. Reason - text

2. ReasonCode - optionSet

 

I have written plugin which will trigger on record creation, I want to set value for Reasoncode based on the value in Reason field.

 

I have around 35 options in the Reasoncode. Is there any other way I can do this rather than using 35 if or case conditions?

 

Thank you... 

2 REPLIES 2
rampprakash
Super User
Super User

Hello @Amruthavarshini,

 

As per your scenario, we need to use if..else or Switch Case to achive this Scinatio in PreCreate Operation there is no other way.

 

My Suggestion will be, if we are having with in 10 values its good to go with Optionset Value else its good to go with Lookup(by creating custom table)

 

Please mark as Answer if it is helpful and provide Kudos


Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
Blog : https://microsoftcrmtechie.blogspot.com

 

shi012
Frequent Visitor

Hello @Amruthavarshini,

 

If you are looking for a course to learn more about Plugins and JavaScript do check out this website. Dynamics Labs 

 

Regards

shi012

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Users online (2,806)