web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / MultiSelect OptionSet ...
Power Pages
Unanswered

MultiSelect OptionSet in Entity Form MetaData - OnSave

(0) ShareShare
ReportReport
Posted on by 92

Hi Everybody,

 

Current setup:

1. Within Dynamics Portal I am creating new records through Entity Forms (Basic Forms). I am able to set "default" values on Save of a new record using MetaData - Attribute Setting for OptionSets as well as for textfields and so on:

GeraldGut_0-1665144603783.pngGeraldGut_1-1665144619007.png

 

I tried the same for a MultiOptionSet field.

Unfortunately, the field is not chooseable in the Basic Form Metadata - Attribute.

The field is simply not visible.

GeraldGut_2-1665144887791.png

 

Is this by design, that MultiOptionSet fields are not supported?

 

Only way which comes in my mind as a workaround is to add the field on the form, hide the field and prefill with JavaScript.

Any ideas how to use such field types in MetaData?

 

Thx and best regards,

Gerald Gut

 

Categories:
I have the same question (0)
  • H V Profile Picture
    1,510 on at

    Hi @GeraldGut 

     

    Please set a integer value of particular option:

    hardikv_0-1665147531608.png

     

     

    Please set value of option here:

    GeraldGut_1-1665144619007.png

     

    --------------------------
    If you like this post, give a Thumbs up. Where it solved your query, Mark as a Solution so it can help other people!

     

     

     

  • H V Profile Picture
    1,510 on at

    Hi @GeraldGut 

     

    In advance, you can refer below blog:

    https://nebulaaitsolutions.com/prepopulate-option-set-field-value-in-powerapps-portal-no-code/

  • GeraldGut Profile Picture
    92 on at

    Hi @hardikv ,

     

    I think you missunderstood what I mean.

    It is already working for OptionSet fields as well as for Text and Integer....

    My first screens was only the working example.

     

    What is currently not working is the same for MultiOptionSet fields.

    Such field types are simply not chooseable in the MetaData Attribute Setting as marked in the last screen.

     

    Questions:

    - Is it possible to use MultiOptionSet fields within MetaData?

    - How do I do so?

    - Workarounds in case this is not supported. --> JavaScript?

     

    Thx and best regards,

    Gerald Gut

  • H V Profile Picture
    1,510 on at

    Hi @GeraldGut 

     

    I have tried, However I'm not able to see multiselect optionset field in MetaData. 

     

    Please refer below blog: https://debajmecrm.com/how-to-dynamically-set-value-of-choices-multi-select-field-in-power-apps-portals/

     

    --------------------------
    If you like this post, give a Thumbs up. Where it solved your query, Mark as a Solution so it can help other people!

  • GeraldGut Profile Picture
    92 on at

    Hi @hardikv ,

    thx for your response. That's the topic I talk about. 🙂

    Unfortunately it looks a bit complicated.

     

    Currently I think I am going to create a WorkflowActivity within CRM which I then try to trigger after record creation through Dynamics Portal.

    I am more comfortable with C# than with JavaScript on BaseForms.

     

    This Workflow Activity will then also be reusable for other workflow scenarious and could be reused again.

    At least this is what I hope.

     

    I found an interesting article how to handle such logic programmatically:

    https://www.inogic.com/blog/2018/09/multi-select-option-set-field-in-dynamics-365-v9-0/

     

    I keep you informed regarding my results in case you are interested to it.

     

    Thx again.

     

    Best Regards,

    Gerald Gut

  • GeraldGut Profile Picture
    92 on at

    Hi @hardikv ,

     

    I got my workflow Activity to work.

    Here is the sourcecode for everyone who is interested:

    public partial class AddMultiOptionSet : BaseWorkflow
     {
     [RequiredArgument]
     [Input("InSchemaName")]
     public InArgument<String> strSchemaName { get; set; }
    
     [RequiredArgument]
     [Input("InOptionSetValue")]
     public InArgument<int> strOptionSetValue { get; set; }
    
     [RequiredArgument]
     [Input("InKeepExistingValues")]
     public InArgument<bool> bolKeepExistingValues { get; set; }
     protected override void ExecuteInternal(LocalWorkflowContext context)
     {
     IWorkflowContext wfContext = context.CodeActivityContext.GetExtension<IWorkflowContext>();
     IOrganizationServiceFactory serviceFactory = context.CodeActivityContext.GetExtension<IOrganizationServiceFactory>();
     IOrganizationService service = serviceFactory.CreateOrganizationService(wfContext.InitiatingUserId);
     ITracingService tracing = context.CodeActivityContext.GetExtension<ITracingService>();
    
     tracing.Trace("START AddMultiOptionSet");
    
     var strSchemaName = this.strSchemaName.Get(context.CodeActivityContext);
     var strOptionSetValue = this.strOptionSetValue.Get(context.CodeActivityContext);
     var bolKeepExistingValues = this.bolKeepExistingValues.Get(context.CodeActivityContext);
    
     tracing.Trace("Retrieve Record");
     Entity entUpdate = service.Retrieve(wfContext.PrimaryEntityName, wfContext.PrimaryEntityId, new Microsoft.Xrm.Sdk.Query.ColumnSet(strSchemaName));
    
     tracing.Trace("Set Collection");
     OptionSetValueCollection optColl = new OptionSetValueCollection();
     if (bolKeepExistingValues)
     {
     if (entUpdate.Attributes.Contains(strSchemaName) && entUpdate.Attributes[strSchemaName] != null)
     optColl = (OptionSetValueCollection)entUpdate.Attributes[strSchemaName];
     }
    
     tracing.Trace("Add OptionSet");
     optColl.Add(new Microsoft.Xrm.Sdk.OptionSetValue(strOptionSetValue));
    
     entUpdate.Attributes[strSchemaName] = optColl;
     tracing.Trace("Execute Update");
     service.Update(entUpdate);
    
     tracing.Trace("FINISH AddMultiOptionSet");
     }
     }

     

    I have created a Flag Field (OptionSet) within CRM which is filled through MetaData Attribute on Portal side.

    Then I created a workflow which is triggered onCreate of the record. Depending on the flag field the workflowActivity is called within the workflow with different parameters and adds the MultiOptionSet Value to the field.

     

    GeraldGut_0-1665489558664.png

     

    That's it.

     

    Maybe someone can reuse it or has improvement hints for me. 😉

     

    Best regards

    Gerald Gut

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
11manish Profile Picture

11manish 42

#2
Valantis Profile Picture

Valantis 24

#3
omkarsupreme Profile Picture

omkarsupreme 23

Last 30 days Overall leaderboard