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 Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Users online (2,167)