Skip to content

Instantly share code, notes, and snippets.

@alexed1
Created September 16, 2018 21:39
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save alexed1/2681d302fc0b2bb178fe8e5436c97c12 to your computer and use it in GitHub Desktop.
global with sharing class AssessCustomerStatus {
@InvocableMethod
public static List<Results> GetStatus (List<Requests> requests)
{
//this operates off the current User
Id userId = UserInfo.getUserId();
User curUser = [select name, RevenueTier__c, contactid, contact.accountid from user where id = :userid];
Integer severeCaseCount = [SELECT COUNT()
FROM Case, Case.Contact
WHERE Contact.Name = :curUser.name AND Priority = 'High'
];
Results curResult = new Results();
curResult.severeCaseCount = severeCaseCount;
curResult.revenueTier = curUser.RevenueTier__c;
List<Results> resultsList = new List<results>();
resultsList.add(curResult);
return resultsList;
}
global class Requests {
@InvocableVariable
global String curUserId;
}
global class Results {
@InvocableVariable
global Integer severeCaseCount;
@InvocableVariable
global Decimal revenueTier;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment