Dynamic Field in Lightning web component salesforce - salesforce

We need to create a lightning web component where we would input the following fields of the Case Object (These fields would be dynamic. Can be changed without changing any code. Make all fields required):
Account
Contact
Type
Case Reason
Product
Subject
Description
And there would be two buttons Submit Case and Cancel. When user clicks on the Submit button the system would create a case in Salesforce with the values defined in the input.

Related

Salesforce Screen flow search and display record information

I'm working on a screen flow. The idea is to have a lookup component the user can search a contact. Then I would like to display the information from the Contact (Account Name, Contact Name, Number Email) and I would like to be able to have the user update that information if needed. I just stomped on how it can be done. I know it should be able to be pulled from the record ID in some type of way and maybe use an Assignment to display the information. Can someone guide me on a next step or if anyone has an instructional video would be helpful.
Thanks
You wouldn't be able to display the looked up contact's fields on that screen as soon as you populate that field. That would be something only possible in code (aura component or lwc).
What you can do, however is -
Get Record element after that screen element. (Get Contact, where Id = lookupcomponent.recordId)
Then EITHER:
use the new Fields (BETA) option on another screen Fields (BETA)
(this method is easier, doesn't have as much control and is limited on fields, depending on data type, you can use)
add inputs one by one and set the default values Add Fields One By One
(this method allows more control)
Then, you will need an update element. If you used the Fields (BETA) you can just update the record variable. If you did the inputs one by one, you will need to update the contact and set fields individually.
Full Flow Example

Enabling country/State picklist on custom fields in Salesforce

Under Accounts, we have a custom fields for Project country and Project State, I am trying to enable to the Country/State picklist for these custom fields.
Looking for any 3rd party plugin which will implement for Country/State picklist within Salesforce on custom field.
Followed the steps from https://resources.docs.salesforce.com/204/latest/en-us/sfdc/pdf/state_country_picklists_impl_guide.pdf for Enabling the State/country picklist, however it just worked on Address Standard field.
I need to implement the same on custom fields.
Please note: I have already implemented Global value picklist, and using the field dependency created controlling picklist (Country) and Controlled (State), however the dependent picklist has a limitation of 1500 values only.
Looking for any 3rd party plugin which will implement for Country/State picklist within Salesforce on custom field.
According to me there is no standard approach or configuration you can do to achieve this. I would suggest you to have a custom metadata and lightning component.
On the Account have a text field:
1. Country
2. State
Custom Metadata:
1. Country
2. State
You can have a relationship field from State to Country. Create all the country and State records.
Build a custom lightning component to add it on the detail page of Account. On this component show the Country and State value from Account fields. Have a edit button when you edit Country and State should be displayed as picklist. When you change the Country State picklist should be populated from the metadata.

Show Opportunity Stage Name Picklist read only based on user role

I am new to Salesforce and need an idea how is possible that suppose I have one user named "ABC".I don't want to show the Opportunity StageName picklist when "ABC" user login in editable form or just want to show the StageName value in textfield or anything other.
I tried to set the permission under setup but not achieved what I want. I just came to know that formula field or formula will used for that, as I am new to Salesforce so I unable to create a formula field.
Thanks.
To achieve this You should try field level security settings:
https://login.salesforce.com/help/doc/en/admin_fls.htm
You can select per field /profile combination which fields are visible and which are editable.
You cannot apply FLS on system required fields neither can you make them read only on the page layouts. You also cannot remove such fields from page layout. In short you are stuck with this field for ever!
I wish Stage was not a required field.
Mitesh

Sales-force Custom Object Edit page layout and Button

We have a custom object say Sales form. On edit apge of customer object we need to add a button Save and Add Product(similar to One we can have on Opportunity page). User forget to add Product/SKU after saving the sales form
New Button(Save and Add product), will save the sales-form first and then depends on record type will open the related list(child object).
Say a Sales form is for Custom Program, after save,. it will open up Custom Program relate list.
If Record type is of Price Change Notification it willl open up related list of SKU detail..
Is this possible, please adivse, we have 9-10 different record type, and we don't want to re-write the application with visualforce and all customization. Re-writing with Visualforce page has some pitfalls.
As far as I'm aware, you can't replace the Save button as it's part of the Edit page and not the standard layout, so to achieve this with one button you'd need to write a custom visualforce page, this need not be complicated though — a simple custom controller which uses a standardController for management of the record would suffice.
You would call Save on the StandardController and then return a different page redirect based on the record type, the page itself would pretty much only consist of an <apex:detail> tag. If you want more details I can provide more.
If you really don't want to write any custom code or pages then you'll need to do this as a two step process, i.e. use the standard page and then have a custom "Continue" button which takes the user onto a custom URL based on the record type. I've just created a contrived version of this by doing the following:
1 - Define a custom formula field on the object, this should be of type text and can use a CASE() statement to determine the URL which the user will be taken to when hitting the button (note that this was made just for the sake of an example so it forwards to the accounts standard page for the record type 'Friend' and contacts page for 'Foe').
CASE($RecordType.DeveloperName, 'Friend', '../001/o', 'Foe', '../003/o', '')
Note the reason I use a formula field here instead of the doing this in the custom button is that for some reason you can't seem
access the record types by name when defining a custom button.
2 - Define a custom button for the object called "Continue" or something similar that makes sense for you. For my example I just used the Contact object, so I referenced the custom field on my record and specified the options shown here:
3 - Customise the page layouts used by your record types to include this new button and you should be done!

Custom Button to copy data from Opportunity into a related custom object

I have a custom object that is used for product setup that is mapped to an opportunity. It's a one to many relationship - one opportunity maps to many setup objects, but one setup object is only mapped to one opportunity.
Opportunity has some setup fields that need to act as defaults for the related custom object. Unfortunately, I cannot just specify them in a formula - getting an error.
What I would like to do is have a custom button that would allow user to click and copy all of the related setup fields from the opportunity into the custom setup object and then edit them as needed.
Any pointers or sample code are greatly appreciated!
You can achieve this with a custom button on the related list for your custom object on the opportunity detail page.
All of the fields on a standard Salesforce new/edit screen have id's associated with them. You can specify values for fields by using these ids to set GET parameters on your URL. For example if the id on the name field on your opportunity is 'opp3', the following URL will populate the name field on your new opportunity page:
https://na2.salesforce.com/006/e?opp3=Hello+World
You would have to change na2 to the correct server for your org.
The new record page URL contains the 3 character id prefix for your particular object and then '/e'. 006 is the prefix for opportunities. You will have to attempt to create a new record to see what the 3 characters are for your custom object.
You will have to capture the id's of the fields you want to populate on your custom object. You can do this by viewing the source of the new record page. For custom fields these id's will take the form of a Salesforce Id (eg. 00N40000002QhEV).
Create a new list button on your custom object and set the behavior to without header and sidebar and set the source to URL. Build up your URL with id=value pairs separated by '&' using the id you got from the page source and the insert field functionality to select the opportunity fields your wish to add in. You should end up with something like this:
/a0U/e?00N40000002QhEV={!Opportunity.Name}&00N40000002QhEW={!Opportunity.StageName}
a0U should be replaced by the correct prefix for your custom object. Then add your button to the related list for your custom object under opportunity.

Resources