Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

Change Option set label based on formtype using javascript in crm 365

Posted on by 2,665

Hi All,

How can i show one option set value to different label name based on condition like based on form type.

Action option set field is there on entity Action has 1 option set value suppose A 

Then based on form type suppose If form is B then show this option value with some different label ex :Send Action & If form is C then show this option value with some different label Send Condition

Is there anypossibility ?

Thanks,

Jharana

  • Ran Zhang Profile Picture
    Ran Zhang on at
    RE: Change Option set label based on formtype using javascript in crm 365

    Hi Jharana,

    I didn't test but I think this could be possible.

    Can't we create a JS to determin current form type and then set the optionset value?

    Xrm.Page.ui.formSelector.getCurrentItem().getLabel();

    Xrm.Page.getattribute()setvalue(); like this.

  • Verified answer
    Pradeep Rai Profile Picture
    Pradeep Rai 5,490 Super User 2024 Season 2 on at
    RE: Change Option set label based on formtype using javascript in crm 365

    Hi Jharana,

    I don't think it is possible. because to add custom logic in option set field we need to define the list of option.

    Suggestion:

    if you want to change the text then instead of option set field we can use the SingleLine of Text

    and we can keep field read only so that user will not be able to update anything.

    Thanks,

    Pradeep.

    Please mark this as VERIFIED if it helps.

  • Jharana Baliyar Singh Profile Picture
    Jharana Baliyar Singh 2,665 on at
    RE: Change Option set label based on formtype using javascript in crm 365

    Hi Pradeep,

    Thanks for the reponse.yes different forms like A,B.

    With only one option set value it should rename & show with different text & for form B the same option value should get rename to different text.

    Is it possible in CRM ? because if we are having 2 option set values then we can easily show hide these option values based on different form.

    Thanks,

    Jharana

  • Suggested answer
    Pradeep Rai Profile Picture
    Pradeep Rai 5,490 Super User 2024 Season 2 on at
    RE: Change Option set label based on formtype using javascript in crm 365

    Hi Jharana,

    Just wanted to confirm, Form Type refers to different form label?

    As per my understanding, consider On Account, I have multiple Forms Says Form A, Form B and Form C then based on selected Form we need to populated the option set.

    if yes then we can use below logic.

    1. Get Form Label using 

    https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/formcontext-ui-formselector

    2. Set Option Set Field 

    formContext.getAttribute(arg).setValue(value)

    Thanks,

    Pradeep.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans