You need to sign in to do that
Don't have an account?
Amans
DML 'Merge' statement
Hey guys ,
I m going through the DML statements in Apex code , while using merge call in my class i got stuck
Im executing through my S-control in this manner
S-Control
var name = "Aman";
var name1="Acme";
var merge_demo = sforce.apex.execute("DML","Mer_demo",{arg:name},{arg1:name1});
Class
webService static Account[] Mer_demo(String arg,String arg1)
{
String[] ss = new String[]{arg};
String[] yy = new String[]{arg1};
Account[] masterAcc = [select id,name from account where name in :ss ];
Account[] mergeAcc = [select id,name from account where name in : yy ];
try{
merge masterAcc mergeAcc ;
}
catch(System.DmlException e)
{
alert(e);
// process exception
}
return masterAcc;
}
when i execute this i got error and it didn't execute ,
anyone can help me in this
plz suggest
thx
Aman Sehgal
I m going through the DML statements in Apex code , while using merge call in my class i got stuck
Im executing through my S-control in this manner
S-Control
var name = "Aman";
var name1="Acme";
var merge_demo = sforce.apex.execute("DML","Mer_demo",{arg:name},{arg1:name1});
Class
webService static Account[] Mer_demo(String arg,String arg1)
{
String[] ss = new String[]{arg};
String[] yy = new String[]{arg1};
Account[] masterAcc = [select id,name from account where name in :ss ];
Account[] mergeAcc = [select id,name from account where name in : yy ];
try{
merge masterAcc mergeAcc ;
}
catch(System.DmlException e)
{
alert(e);
// process exception
}
return masterAcc;
}
when i execute this i got error and it didn't execute ,
anyone can help me in this
plz suggest
thx
Aman Sehgal
through merge statement you can process max 3 records including the master record.. but in your code mergeAcc may contains more than 2 records.. so first limit that and process it. And one more condition also you have to check i.e. master records should not be included in your child list....
Regards,
Kiran