Showing results for 
Search instead for 
Did you mean: 
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... 

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 :
Blog :


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 




Helpful resources

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 (3,174)