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 option in ...
Power Pages
Unanswered

Multiselect option in power portal

(0) ShareShare
ReportReport
Posted on by 4

Multiselect Options Solutions in PowerApps Portals Form,


We have to set up two column in database (cds) table(entity). One (socialmediatype) is your which store comma seperated value, and second (socialmediatypehide) is which show on form but hide by js.

 

  1. ‘socialmediatype’ this text field column will add on form and hide by js.
  2. ‘socialmediatypehide’ this text field column will not add on form only save values.

 

Add below js in Portal management > Webpages> Advanced

 

picture3.png

 

var socialmediatype = $('#cr8d8_socialmediatype');

socialmediatype .hide();

 

var multiselect = $('<select multiple><option value="948180000">Facebook</option><option value="948180001">Instagram</option><option value="948180001">Whatsapp</option></select>');

multiselect.val(socialmediatype.val().split(','));

multiselect.insertAfter(socialmediatype).multiselect();

multiselect.change(function() {

socialmediatype.val($(this).val());

});

 

Add below code in your C# plug in.

 

 

using System;

using Microsoft.Xrm.Sdk;

 

namespace PluginsDemo

{

public class Post : IPlugin

{

public void Execute(IServiceProvider serviceProvider)
{
var context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

var entity = context.InputParameters["Target"] as Entity;

if (entity.Attributes.ContainsKey("cr8d8_socialmediatype"))
{
OptionSetValueCollection socialmedia = new OptionSetValueCollection();
foreach (var option in entity.Attributes["cr8d8_socialmediatype"].ToString().Split(','))
{
socialmedia.Add(new OptionSetValue(int.Parse(option)));
}

entity["cr8d8_socialmediatypehide"] = socialmedia;
}
else if (entity.Attributes.ContainsKey("cr8d8_socialmediatypehide"))
{
entity["cr8d8_socialmediatype"] = string.Join(",", entity.Attributes["cr8d8_socialmediatypehide"].ToString());
}
}

}

}

 

Here is the magic.Now you can get and set all social media types.

 

Picture2.png

 

 

Categories:
I have the same question (0)

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!

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 26 Super User 2026 Season 1

#2
Lucas001 Profile Picture

Lucas001 19 Super User 2026 Season 1

#3
CN-06091549-0 Profile Picture

CN-06091549-0 18

Last 30 days Overall leaderboard