Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
joao_pires
Frequent Visitor

Persist text when publish report custom visual

Hi,

In custom visual :

When i publish report, how  persist or get text 

to input how to custom visual Text toFilter does?

For now the filters are applied.

 

thanks

 

image.png

1 ACCEPTED SOLUTION

Don't call this.visualHost.persistProperties in enumerateObjectInstances method since such implementation might cause an infinite update loop if Format Panel is opened.

Are there any exceptions? Can you share the embedded Power BI report to debug it?

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

View solution in original post

3 REPLIES 3
v-viig
Community Champion
Community Champion

To keep data in Power BI you should define a property in objects property of capaiblities.json (documentation).

After that call persistProperties to send settings to Power BI host.

As a result the saved data will be in objects object of metadata.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

 

Hi ,

thanks your reply.

I folowed this steps but in sandbox mode works well, but when package this visual not works. why?

Help me pls.

my code:

  Capabilities

 "objects": {
        "settings": {
            "properties": {
                "config": {
                    "type": {
                        "text": true
                    }
                },
                "show": {
                    "type": {
                        "bool": true
                    }
                }

            }
        },
        "general": {
            "displayName": "General",
            "displayNameKey": "formattingGeneral",
            "properties": {
                "selection": {
                    "displayName": "Selection",
                    "type": {
                        "text": true
                    }
                },
                "filter": {
                    "type": {
                        "filter": true
                    }
                },      

  method Update:

 this.values = JSON.parse(getValue(this.dataView.metadata.objects, "settings", "config", "No items"));
           let items="";
           this.values.forEach(element => {
                items+=element+"\n";
            });
           
$("#q").val(items);

Enumerate:

 

 public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[] | VisualObjectInstanceEnumerationObject {
           // return VisualSettings.enumerateObjectInstances(this.settings || VisualSettings.getDefault(), options);
             let objectName = options.objectName;
            let objectEnumeration: VisualObjectInstance[] = [];
         
           

            this.visualHost.persistProperties(<VisualObjectInstancesToPersist>{
                merge: [{
                    objectName: "settings",
                    selector: null,
                    properties: {
                        config: JSON.stringify(this.values) || "{}",
                        show:true
                    }
                }]
            });

            return objectEnumeration;

        }

DataView :

image.png

Don't call this.visualHost.persistProperties in enumerateObjectInstances method since such implementation might cause an infinite update loop if Format Panel is opened.

Are there any exceptions? Can you share the embedded Power BI report to debug it?

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors