📝 Update and organize project documentation and assets
This commit is contained in:
@@ -0,0 +1 @@
|
||||
public Map<String, String> convertCodesToIds() {
String accountCode = (String)arguments.get('accountCode');
String locationCode = (String)arguments.get('locationCode');
String sessionCode = (String)arguments.get('sessionCode');
String orderCode = (String)arguments.get('orderCode');
Map<String, String> ids = new Map<String, String>();
if (!AvocadoUtils.invalidString(accountCode)) {
Account[] acc = [
SELECT Id
FROM Account
WHERE Code__c = :accountCode
];
if (acc == null || acc.size() == 0) {
throw new AvocadoException('Could not find any account from code');
}
ids.put('accountId', acc[0].Id);
}
if (!AvocadoUtils.invalidString(locationCode)) {
Location__c[] loc = [
SELECT Id
FROM Location__c
WHERE Code__c = :locationCode
];
if (loc == null || loc.size() == 0) {
throw new AvocadoException('Could not find any location from code');
}
ids.put('locationId', loc[0].Id);
}
if (!AvocadoUtils.invalidString(sessionCode)) {
Session__c[] ses = [
SELECT Id
FROM Session__c
WHERE Code__c = :sessionCode
];
if (ses == null || ses.size() == 0) {
throw new AvocadoException('Could not find any session from code');
}
ids.put('sessionId', ses[0].Id);
}
if (!AvocadoUtils.invalidString(locationCode)) {
Order[] ord = [
SELECT Id
FROM Order
WHERE Code__c = :orderCode
];
if (ord == null || ord.size() == 0) {
throw new AvocadoException('Could not find any order from code');
}
ids.put('orderId', ord[0].Id);
}
return ids;
}
|
||||
Reference in New Issue
Block a user