Git Product home page Git Product logo

Comments (6)

savage25 avatar savage25 commented on July 18, 2024

I believe the only changes needed are to URL_CreateRecordCmpHelper.js -- see below.
It allows the parameters to have "c__" prefix... then, throughout your code or actions, add "c__" to all the parameters passed to the page.

URL_CreateRecordCmpHelper.js

let lowerKey = key.toLowerCase();
change to
let lowerKey = key.toLowerCase().replace(/^c__/, "");

        for ( let fieldName in pageRef.state ) {
            if ( fieldDescribeMap.hasOwnProperty( fieldName ) && fieldDescribeMap[fieldName].createable && pageRef.state[fieldName] ) {
                eventParamMap.defaultFieldValues[fieldName] = pageRef.state[fieldName].replace(/\+/g, " ");
            }
        }

change to

        for ( let key in pageRef.state ) {
            let fieldName = key.replace(/^c__/, "");
            if ( fieldDescribeMap.hasOwnProperty( fieldName ) && fieldDescribeMap[fieldName].createable && pageRef.state[key] ) {
                eventParamMap.defaultFieldValues[fieldName] = pageRef.state[key].replace(/\+/g, " ");
            }
        }

from sfdx-record-create-url-component.

MuriloKakazu avatar MuriloKakazu commented on July 18, 2024

It looks like that url parameters with a __c suffix are dropped as well (even with the namespace), so I did the following in the remote controller and checked on js whether the field was custom or not, just to pass it with the suffix when mapping the event params:

fieldDescribeMap.put( fieldDescribe.getName(), new Map<String, Object>{
    'accessible' => fieldDescribe.isAccessible(),
    'createable' => fieldDescribe.isCreateable(),
    'updateable' => fieldDescribe.isUpdateable(),
    'custom'     => fieldDescribe.isCustom()
});
if ( helper.isCustomField( fieldName, fieldDescribeMap ) ) {
    fieldName += '__c';
}

from sfdx-record-create-url-component.

savage25 avatar savage25 commented on July 18, 2024

Well, now it appears that the parameters with both prefix AND suffix (c__*__c) are being dropped, but if they have just the suffix, they are OK? Argh, what the heck is SFDC doing? :(

Neither of these pass "Case_Product" parameter (last one)...

https://dnb--fcs.lightning.force.com/lightning/cmp/c__URL_CreateRecordCmp?c__objectName=Case&c__recordId=0030c00002kHcNfAAK&c__recordTypeId=01230000000bkCKAAY&c__AccountId=0013000000q3cO4AAI&c__ContactId=0030c00002kHcNfAAK&c__Description=&c__ParentId=5000U000009LgBYQA0&c__Case_Product__c=SFDC

https://dnb--fcs.lightning.force.com/lightning/cmp/c__URL_CreateRecordCmp?c__objectName=Case&c__recordId=0030c00002kHcNfAAK&c__recordTypeId=01230000000bkCKAAY&c__AccountId=0013000000q3cO4AAI&c__ContactId=0030c00002kHcNfAAK&c__Description=&c__ParentId=5000U000009LgBYQA0&c__Case_Product=SFDC

This one passes the Case_Product__c through...

https://dnb--fcs.lightning.force.com/lightning/cmp/c__URL_CreateRecordCmp?c__objectName=Case&c__recordId=0030c00002kHcNfAAK&c__recordTypeId=01230000000bkCKAAY&c__AccountId=0013000000q3cO4AAI&c__ContactId=0030c00002kHcNfAAK&c__Description=&c__ParentId=5000U000009LgBYQA0&Case_Product__c=SFDC

Resulting with:
defaultFieldValues: {AccountId: "0013000000q3cO4AAI", ContactId: "0030c00002kHcNfAAK", ParentId: "5000U000009LgBYQA0", Case_Product__c: "SFDC"}

from sfdx-record-create-url-component.

savage25 avatar savage25 commented on July 18, 2024

I bet I know why... they are looking for double underscore, and only passing parameters that have one (and only one) set of double underscores. (So they see "Case_Product__c" as a "Namespace" of "Case_Product" and the parameter of "c".)
So disappointed by SFDC's solutions lately, they really seem to be taking shortcuts and not thinking things through.
Thankfully I currently hard-code all the links and parameters (field names) I'm passing at the moment, so I've simply removed the "c__" prefix accordingly... but I'm watching closely for them to change the way they handle parameters going forward for the Summer '19 release.

from sfdx-record-create-url-component.

savage25 avatar savage25 commented on July 18, 2024

PS: @MuriloKakazu Your solution to add the "__c" to the field name won't work if you have a standard and custom field with the same name -- like "AccountId" and "AccountId__c" (which we actually have [sigh]).

from sfdx-record-create-url-component.

bryandrev12 avatar bryandrev12 commented on July 18, 2024

So does this work in Summer 19? I am on Summer 19 and I see that it does strip the URL to lightning/cmp/c__URL_CreateRecordCmp even though I have /lightning/cmp/c__URL_CreateRecordCmp?recordId={!Account.Id}&objectName=Contact

and states: This page isn't available in Salesforce Lightning Experience or mobile app.

from sfdx-record-create-url-component.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.