function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Salesforce 10026Salesforce 10026 

How can I populate case AccountId field through web-to-case?

Hi all,

 

How can I populate the case account id field through a web-to-case submition?

I've tried to use the fields: account.id and accountid but none worked.

Upon case submition I already know the account id value.

Thanks.

 

 

 

 

 

 

Best Answer chosen by Salesforce 10026
Magesh Mani YadavMagesh Mani Yadav
Hi Salesforce 10026,

I have a solution to your problem hope that helps.
  • First you need to create a custom text field with length 18 for the Case object and name it as AccountTestId__c.
  • then go the field detail page and then copy the highlighted 15 char id from your org
  • User-added image
  • then add en element to your existing webtocae HTML like this
  • <label for="name">AccountId</label><input  id="00N5800000BTIRk" maxlength="18" name="00N5800000BTIRk" size="20" type="text" /><br>
  • Create a before case trigger to assign this AccountTextId__c to the actual AccountId of the standard Case field.

In this way you can pass Accountid via WEBTOCASE.Hope my solution helped you.

Thanks,
Magesh
 

All Answers

SalesFORCE_enFORCErSalesFORCE_enFORCEr
I don't think Account is available in Web to Case. It gets populated through Contact automatically.
Salesforce 10026Salesforce 10026

When creating a Case in process builder we can directly populate the field AccountId with any ID string like: "001F000001nJEvi".

So why can't we send the same parameter populated through a web-to-case submission, if we have exactly the same value?

Something like this:

https://www.salesforce.com/servlet/servlet.WebToCase?encoding=UTF-8&description="Test"&status="Open"&...&AccountId="001F000001nJEvi"

 

SalesFORCE_enFORCErSalesFORCE_enFORCEr
All the fields are not available in Web to Case. Web-generated cases are automatically linked to the relevant contact and account based on the customer’s email address.
Magesh Mani YadavMagesh Mani Yadav
Hi Salesforce 10026,

I have a solution to your problem hope that helps.
  • First you need to create a custom text field with length 18 for the Case object and name it as AccountTestId__c.
  • then go the field detail page and then copy the highlighted 15 char id from your org
  • User-added image
  • then add en element to your existing webtocae HTML like this
  • <label for="name">AccountId</label><input  id="00N5800000BTIRk" maxlength="18" name="00N5800000BTIRk" size="20" type="text" /><br>
  • Create a before case trigger to assign this AccountTextId__c to the actual AccountId of the standard Case field.

In this way you can pass Accountid via WEBTOCASE.Hope my solution helped you.

Thanks,
Magesh
 
This was selected as the best answer
Salesforce 10026Salesforce 10026

Thanks, Magesh!

That sounds like a viable solution, I'll try it immediately :)

 

Salesforce 10026Salesforce 10026
Just for the record, the solution worked perfectly!
Arnaud LloretArnaud Lloret
Hi @Magesh Mani Yadav, how to you set the before case trigger? Thanks!
Hassaan Siddiqui 2Hassaan Siddiqui 2
is the same senerio work for the Account name?