Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
713 B
5
Indexable
Never
public class helper_class {
	public static void metodo_trigger(list <contact> contatti) {
        list <contact> copia = [select id, accountid, description from contact where id in: contatti];
        list <contact> app = new list <contact> ();
        account a = new account (name = 'nome');
        insert a;
        for (contact c : copia) {
            if(c.accountid == null) {
                c.accountid = a.id;
                app.add(c);
            }
            else {
                if (c.description != 'possiede già un padre'){
					c.description = 'possiede già un padre';
                    app.add(c);
                }
            }
        }
        update app;
    }
}