You need to sign in to do that
Don't have an account?
Jsingh
Apex in Process Builder
Hi
When i am trying to call Apex class in Process Build using @invocablemethod it's giving following error.(the same class
i was calling using trigger also)
unsupported parameter type string.valid invocable parameters must be
List type like list where T is a supported type
apex code is here
1
//Helper class to update customfield with autonumber field in after insert
public class updatfield
4
{
5
@InvocableMethod(Label='abc')
6
!
public static void updateoutputfield(string accountid ) //Helper class method passing one parameter
7
{
8
if(string.isNotBlank(accountid)) //check the accountid is not blank
9
{
10
11
//retrieve the value of all required field from account
12
13
Account acc=[select id , Name,Division__c, Group__c, Subgroup__c, AutoNumber__c from account where id=:accountid];
14
15
acc.Account_Number__c= acc.Division__c.substring(0,2).Touppercase()+'-'+ acc.Group__c.substring(0,2).Touppercase() + '-' + acc.Subgroup__c.substring(0,2).Touppercase() + '-'+ acc.AutoNumber__c;
16
update acc;
17
18
system.debug('Record has updated.............' + acc);
19
}
20
21
}
22
}
Trigger Code
//Trigger to update custom field Account Number on Account abject with Auto number field
trigger autonumberpopulate on Account (after insert) {
set<Account> listOfAccount =new set<Account> ();//we want unique value that's why we are using 'set' collection
for (Account accounts: [select id, Name, Division__c,Group__c,Subgroup__c,AutoNumber__c from Account])
{
ListOfAccount.add(accounts); //get all account id
}
for(Account newaccounts : Trigger.new) // retrieve all new accounts using for loop (bulkify)
{
//calling handler method updateoutputfield using handler class updatfield.
updatfield.updateoutputfield(string.valueOf(newaccounts.id));
}
}
Please help me
Regards
jyotsana
When i am trying to call Apex class in Process Build using @invocablemethod it's giving following error.(the same class
i was calling using trigger also)
unsupported parameter type string.valid invocable parameters must be
List type like list where T is a supported type
apex code is here
1
//Helper class to update customfield with autonumber field in after insert
public class updatfield
4
{
5
@InvocableMethod(Label='abc')
6
!
public static void updateoutputfield(string accountid ) //Helper class method passing one parameter
7
{
8
if(string.isNotBlank(accountid)) //check the accountid is not blank
9
{
10
11
//retrieve the value of all required field from account
12
13
Account acc=[select id , Name,Division__c, Group__c, Subgroup__c, AutoNumber__c from account where id=:accountid];
14
15
acc.Account_Number__c= acc.Division__c.substring(0,2).Touppercase()+'-'+ acc.Group__c.substring(0,2).Touppercase() + '-' + acc.Subgroup__c.substring(0,2).Touppercase() + '-'+ acc.AutoNumber__c;
16
update acc;
17
18
system.debug('Record has updated.............' + acc);
19
}
20
21
}
22
}
Trigger Code
//Trigger to update custom field Account Number on Account abject with Auto number field
trigger autonumberpopulate on Account (after insert) {
set<Account> listOfAccount =new set<Account> ();//we want unique value that's why we are using 'set' collection
for (Account accounts: [select id, Name, Division__c,Group__c,Subgroup__c,AutoNumber__c from Account])
{
ListOfAccount.add(accounts); //get all account id
}
for(Account newaccounts : Trigger.new) // retrieve all new accounts using for loop (bulkify)
{
//calling handler method updateoutputfield using handler class updatfield.
updatfield.updateoutputfield(string.valueOf(newaccounts.id));
}
}
Please help me
Regards
jyotsana
Please try like this and open your debug log and print whether your helper class is passing parameter or not.
Thank You
www.nubeselite.com
Developement | Training | Consulting
Please Mark this assolution if your problem resolved.