You need to sign in to do that
Don't have an account?
David H 18
Data Integration Specialist: Challenge 5 - Not Completing
Hi,
I'm currently working through the Data Integration Specialist superbadge and my attempt throws the following error when I check the challenge:
Challenge Not yet complete... here's what's wrong:
The 'ProjectRESTService' Apex REST service does not appear to be using a SavePoint to rollback change when an exception occurs.
I don't really understand this error as I appear to have implemented a SavePoint for rolling back changes, so any suggestions would be much appreciated.
Thanks.
I'm currently working through the Data Integration Specialist superbadge and my attempt throws the following error when I check the challenge:
Challenge Not yet complete... here's what's wrong:
The 'ProjectRESTService' Apex REST service does not appear to be using a SavePoint to rollback change when an exception occurs.
I don't really understand this error as I appear to have implemented a SavePoint for rolling back changes, so any suggestions would be much appreciated.
@RestResource(urlMapping='/project/*') global with sharing class ProjectRESTService { @HttpPost global static String postProjectData(String projectRef, String projectName, String opportunityId, Date startDate, Date endDate, Double amount, String status) { List<Project__c> projects = [ SELECT ProjectRef__c, Name, Opportunity__c, Start_Date__c, End_Date__c, Billable_Amount__c, Status__c FROM Project__c WHERE ProjectRef__c=:ProjectRef ]; Project__c project = new Project__c(); if (!projects.isEmpty()) { project = projects[0]; } project.ProjectRef__c = projectRef; project.Name = projectName; project.Opportunity__c = opportunityId; project.Start_Date__c = startDate; project.End_Date__c = endDate; project.Billable_Amount__c = amount; project.Status__c = status; Opportunity opp = [SELECT Id, DeliveryInstallationStatus__c FROM Opportunity WHERE Id=:opportunityId]; opp.DeliveryInstallationStatus__c = 'In Progress'; Savepoint sp = Database.setSavepoint(); try { upsert project; update opp; return 'OK'; } catch(Exception e) { Database.rollback(sp); return e.getMessage(); } } }
Thanks.
You may want to try some debugging even using a tool like Workbench to try and hit your endpoint with proper data and check whether the data is being updated in your objects correctly; you can do that by issuing database queries or using the Reports feature in Salesforce UI.