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

Notifications

Announcements

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 89 Super User 2025 Season 2

#2
Jerry-IN Profile Picture

Jerry-IN 75

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard