You need to sign in to do that
Don't have an account?
Firoz Mirza
A trivial mistake in Trailhead module
A trivial (but helpful, I admit) error in the module 'Apex Integration Services' -> Apex Web Services, in the @HttpPut method -
https://trailhead.salesforce.com/modules/apex_integration_services/units/apex_integration_webservices
An additional line of code (thisCase.id = id;) is missing before the 'upsert' statement in the following practice code of this trailhead section. Request to please correct this if judged appropriate. btw, this mistake was helpful to me during learning....so up to you.
@HttpPut
global static ID upsertCase(String subject, String status,
String origin, String priority, String id) {
Case thisCase = new Case(
Id=id,
Subject=subject,
Status=status,
Origin=origin,
Priority=priority);
// Match case by Id, if present.
// Otherwise, create new case.
upsert thisCase;
// Return the case ID.
return thisCase.Id;
}
https://trailhead.salesforce.com/modules/apex_integration_services/units/apex_integration_webservices
An additional line of code (thisCase.id = id;) is missing before the 'upsert' statement in the following practice code of this trailhead section. Request to please correct this if judged appropriate. btw, this mistake was helpful to me during learning....so up to you.
@HttpPut
global static ID upsertCase(String subject, String status,
String origin, String priority, String id) {
Case thisCase = new Case(
Id=id,
Subject=subject,
Status=status,
Origin=origin,
Priority=priority);
// Match case by Id, if present.
// Otherwise, create new case.
upsert thisCase;
// Return the case ID.
return thisCase.Id;
}
Case thisCase = new Case(
Id=id,
Subject=subject,
Status=status,
Origin=origin,
Priority=priority);
All Answers
Case thisCase = new Case(
Id=id,
Subject=subject,
Status=status,
Origin=origin,
Priority=priority);
Actually, my code had a stupid error and I had missed this crucial parameter.
warm regards