cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MBilal-079
Frequent Visitor

Your control is trying to open a form. This is not yet supported. pcf issue

 

Hi,

 

i'm trying to build a PCF for data grid, when i click on specific record of row at local environment it gives me this error alert

Your control is trying to open a form. This is not yet supported

and after deploying to Model driven app it neither open the record nor shows any error.

here is my click event code in index.ts

 

let rowRecordId = (event.currentTarget as HTMLTableRowElement).getAttribute(RowRecordId);

        if (rowRecordId) {
            let entityReference = this.contextObj.parameters.simpleTableGrid.records[rowRecordId].getNamedReference();
            let entityFormOptions = {
               entityName: entityReference.etn!,
                entityId: entityReference.id.guid,
            }
            this.contextObj.navigation.openForm(entityFormOptions);
        }

 

 

Thanks in advance.

 
 
1 ACCEPTED SOLUTION

Accepted Solutions

Hi @HemantG @a33ik  and @v-xida-msft 

 

Thank you so much for your help and precious time.

 

i was just tried to open the entity form by clicking on the Record Row at the Entity grid view.

I have fixed the issue by updating the EntityReference interface in the 

"node_modules\@types\powerapps-component-framework\componentframework.d.ts"

earlier my code was looked like this

    

interface EntityReference {
/**
* The record id. Read-only.
*/
id: { guid: string; };

/**
* The entity logical name. Read-only.
*/
etn?: string;

/**
* The name of the entity reference. Read-only.
*/
name: string;
}

 

I have updated it

 

interface EntityReference {
      /**
       * The record id. Read-only.
       */
      // id: { guid: string; };
      _id: string;

      /**
       * The entity logical name. Read-only.
       */
      _etn?: string;

      /**
       * The name of the entity reference. Read-only.
       */
      name: string;
   }
 
because when i debug it i console i looked the properties name with "_".
 
Thanks again for your help.
Muhammad Bilal

 

 

 

 

View solution in original post

4 REPLIES 4
v-xida-msft
Community Support
Community Support

Hi @MBilal-079 ,

Do you want to launch a dialog to open your specific Entity Form?

 

The context.navigation.openForm(options [, parameters]) function is used to open a entity form or a quick create form, so please make sure you have specified a proper value for the formId attribute within the EntityFormOptions argument in your context.navigation.openForm(options [, parameters]) function.

In addition, the attributes mentioned within the EntityFormOptions are all Required attribute, so you must provide a proper value each one of them (except "useQuickCreateForm" attribute.)

 

Please consider modify the function in your index.ts file as below:

let rowRecordId = (event.currentTarget as HTMLTableRowElement).getAttribute(RowRecordId);
if (rowRecordId) {
            let entityReference = this.contextObj.parameters.simpleTableGrid.records[rowRecordId].getNamedReference();
            let entityFormOptions = {
                createFromEntity: {
                                    entityType: "xxx",
                                    id: "xxxx",
                                    name: "xxxx"
                                  },
                entityName: entityReference.etn!,
                entityId: entityReference.id.guid,
                formId: "Type specific form Id which you want to display here",   // modify formula here
                height: 580,
                width: 400,
                windowPosition: 1,
                openInNewWindow: false
            }
            this.contextObj.navigation.openForm(entityFormOptions);
        }

The Form Id of the specific Entity form as below:

6.JPG

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello,

Have you enabled Utility in ControlManifest file? If not it will look like following:

    <feature-usage>
      <uses-feature name="Utility" required="true" />
    </feature-usage>

Please check the PCF sample for openForm and compare the runtime parameters and formats - here

Internally it uses the ClientAPI for openForm here .

 

Code snippet below for ClientAPI shows the parameters  

var entityFormOptions = {};
entityFormOptions["entityName"] = "contact";

// Set default values for the Contact form
var formParameters = {};
formParameters["firstname"] = "Sample";
formParameters["lastname"] = "Contact";
formParameters["fullname"] = "Sample Contact";
formParameters["emailaddress1"] = "contact@adventure-works.com";
formParameters["jobtitle"] = "Sr. Marketing Manager";
formParameters["donotemail"] = "1";
formParameters["description"] = "Default values for this record were set programmatically.";

// Open the form.
Xrm.Navigation.openForm(entityFormOptions, formParameters).then(
function (success) {
console.log(success);
},
function (error) {
console.log(error);
});

 

You can check and compare the values for working and non working code in the browser debug console. I suspect that the format might be different. 

 

Hemant

Hi @HemantG @a33ik  and @v-xida-msft 

 

Thank you so much for your help and precious time.

 

i was just tried to open the entity form by clicking on the Record Row at the Entity grid view.

I have fixed the issue by updating the EntityReference interface in the 

"node_modules\@types\powerapps-component-framework\componentframework.d.ts"

earlier my code was looked like this

    

interface EntityReference {
/**
* The record id. Read-only.
*/
id: { guid: string; };

/**
* The entity logical name. Read-only.
*/
etn?: string;

/**
* The name of the entity reference. Read-only.
*/
name: string;
}

 

I have updated it

 

interface EntityReference {
      /**
       * The record id. Read-only.
       */
      // id: { guid: string; };
      _id: string;

      /**
       * The entity logical name. Read-only.
       */
      _etn?: string;

      /**
       * The name of the entity reference. Read-only.
       */
      name: string;
   }
 
because when i debug it i console i looked the properties name with "_".
 
Thanks again for your help.
Muhammad Bilal

 

 

 

 

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,196)