Git Product home page Git Product logo

Comments (4)

savage25 avatar savage25 commented on July 18, 2024

This appears to be an issue with how LEX translates the parameters. So not necessarily an issue with this code. But will leave issue here in case someone can solve for it.

Reference (same issue reported for a different situation):
https://salesforce.stackexchange.com/questions/235913/url-is-formatted-differently-in-classic-vs-lightning

from sfdx-record-create-url-component.

savage25 avatar savage25 commented on July 18, 2024

I added a replace to line 73 of the JS to work-around this situation:

eventParamMap.defaultFieldValues[fieldName] = pageRef.state[fieldName].replace(/\+/g, " ");

from sfdx-record-create-url-component.

douglascayers avatar douglascayers commented on July 18, 2024

Hi @savage25, thanks for the detailed feedback and suggested fix.

However, I'm not able to reproduce the issue in Chrome v73. Could you share how you're invoking the URL?

I'm also testing after having updated the API version of the metadata to v45.0 and in a new scratch org that I created tonight.

What I've tried so far is a custom url button on the Account object whose value is:

/lightning/cmp/c__URL_CreateRecordCmp?objectName=Contact&FirstName=Astro+Tom&LastName=Nomical&LeadSource=Phone+Inquiry&AccountId={!Account.Id}

And then I've tried navigating in the browser to this url, too:

https://yourdomain.lightning.force.com/lightning/cmp/c__URL_CreateRecordCmp?objectName=Contact&FirstName=Astro+Tom&LastName=Nomical&LeadSource=Phone+Inquiry&AccountId=0013B00000Z3oHRQAZ

In both tests, the browser's URL correctly translates the + into %20 and the modal form correctly displays the space in the contact's first name "Astro Tom" and selects the correct Lead Source picklist value of "Phone Inquiry".

lightning/cmp/c__URL_CreateRecordCmp?objectName=Contact&FirstName=Astro%20Tom&LastName=Nomical&LeadSource=Phone%20Inquiry&AccountId=0013B00000Z3oHRQAZ

image

from sfdx-record-create-url-component.

savage25 avatar savage25 commented on July 18, 2024

@douglascayers Sorry, I've deleted my previous reply, as I was mistaken on how I was creating the link to the page. Here are the details to how I create the link to reproduce:

APEX Class Function:

public PageReference New_Transaction() {
	PageReference rtnPage;

	rtnPage = new PageReference('/lightning/cmp/c__URL_CreateRecordCmp');
	rtnPage.getParameters().put( 'objectName', 'Tracker_Transaction__c' );
	if ( theTracker.RecordTypeId == Tracker_Validations.mapTrackerRecTypes.get('Flat File').getRecordTypeId()
	   ) rtnPage.getParameters().put( 'Source__c', 'Flat File' );
	rtnPage.getParameters().put( 'STP_Id__c', theTracker.STP_Id__c );
	rtnPage.getParameters().put( 'Profile_Id__c', theTracker.Profile_Ids__c.left(3) );
	rtnPage.getParameters().put( 'Tracker__c', theTracker.Id );
	rtnPage.getParameters().put( 'End_Date__c', date.Today().year() + '-' + date.Today().month() + '-' + date.Today().day() );

	return rtnPage;
}

Visualforce Page:

<apex:commandLink value="New Transaction" action="{!New_Transaction}" target="_blank"/>

When that link is pressed, the "Source__c" parameter populates the Source__c field with "Flat+File".

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.