You need to sign in to do that
Don't have an account?
The new Learner
Need to update the case when ever the order is created--- urgent
Hi Experts,
i wrote below code after order is created , i need to update the case status 'New' after any field is updated on case and i wrote the code like below but lot of errors, i am not sure how to take case and to update. can you help me pls i wrote the code its totally wrong kindly need a help on this
i am not sure how to use the case here Map<Id, Case> oldMap
if(Trigger.isInsert && Trigger.isAfter){
OrderHandler.OnAfterInsert(Trigger.new, Trigger.newMap);
}
public static void OnAfterInsert(List<order> lstObject, Map<Id, Case> oldMap)
{
set<id> caseIds = new set<id>();
for(order ord : lstObject)
{
if(ord.Case__c!= null)
{
caseIds.add(ord.Case__c);
}
}
if(caseIds != null)
{
for(Case obj : caseIds)
{
for (String fieldName: schemaFieldMap.keySet())
{
if((obj.get(fieldName) != oldMap.get(obj.Id).get(fieldName)))
{
(obj.status=='Partially Complete')) ? obj.status : 'New';
break;
}
}
}
}
}
i wrote below code after order is created , i need to update the case status 'New' after any field is updated on case and i wrote the code like below but lot of errors, i am not sure how to take case and to update. can you help me pls i wrote the code its totally wrong kindly need a help on this
i am not sure how to use the case here Map<Id, Case> oldMap
if(Trigger.isInsert && Trigger.isAfter){
OrderHandler.OnAfterInsert(Trigger.new, Trigger.newMap);
}
public static void OnAfterInsert(List<order> lstObject, Map<Id, Case> oldMap)
{
set<id> caseIds = new set<id>();
for(order ord : lstObject)
{
if(ord.Case__c!= null)
{
caseIds.add(ord.Case__c);
}
}
if(caseIds != null)
{
for(Case obj : caseIds)
{
for (String fieldName: schemaFieldMap.keySet())
{
if((obj.get(fieldName) != oldMap.get(obj.Id).get(fieldName)))
{
(obj.status=='Partially Complete')) ? obj.status : 'New';
break;
}
}
}
}
}
2.you can setup workflow with criteria whenever the case is created/edited
use for below formula in condition
ischanged(lastmodifieddate)
NOT(TEXT(STATUS)='NEW')
Immediate Action:
Update Record That Started This Process
Update Case Status Field to "New"