You need to sign in to do that
Don't have an account?
@DEVS
Creating Opportunity using Rest API with a particular record type
How to create an Opportunity using Rest API with a particular Record type - when the user has access to multiple Record Types.
Below is the sample to create opportunity:
URI: services/data/v39.0/sobjects/Opportunity
Http Method: Post
Input: {"Name":"Opp1","CloseDate":"2018-08-01","StageName":"New","Probability":"10","Amount":"2000"}
Below is the sample to create opportunity:
URI: services/data/v39.0/sobjects/Opportunity
Http Method: Post
Input: {"Name":"Opp1","CloseDate":"2018-08-01","StageName":"New","Probability":"10","Amount":"2000"}
Okey - It was not straight. Input should be as below:
All Answers
Yes You have to pass recordType name, but you can not pass id as it would be different on another org. Also the recordType Name should be avalable in the another org.
Thanks,
Sukanya Banekar
Okey - It was not straight. Input should be as below:
Hello guys,
Is there any solution from when we have more than one Record Types (at different Sobjects) with the same Name?
In my org I have 2 Service types with the name : "Service" in both Account and Case Object.
The answer I get from the server is:
[
{
"message": "Name: more than one record found for external id field: [012090000005uVyAAI, 01 2090000005uWHAAY]",
"errorCode": "DUPLICATE_EXTERNAL_ID",
"fields": [
"Name"
]
}
]
So basically it doenst know what Record type to apply.
II have tried populating the SobjectType but it doenst work.
What i did :
"RecordType": {
"Name": "Service",
"SobjectType" : "Account"
}
Answer I get from server:
[
{
"message": "More than 1 field provided in an external foreign key reference in entity: RecordTyp e",
"errorCode": "INVALID_FIELD",
"fields": []
}
]
Hi Michalis & Eric & Sravani,
The solution I would propose is to differentiate between the Recordtypes with the same value for the 'Name' Field using the 'DeveloperName' field. These two fields can have a different value. Once you have set the 'DeveloperName' field to a unique value the json would need to be changed to (example given would then be for Account object):
"RecordType": {
"DeveloperName": "ServiceAccount"
}
Hope this helps you.
Hi Stijn, it doesn't work and throws an error -
"message: Field name provided, DeveloperName is not an External ID or indexed field for RecordType".
Is there any other possible solution for this?