Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mev_PO_Requisition__c[] lpo = [select id,name,ao_po_id__c,copiedfromaopo__c from mev_PO_Requisition__c where copiedfromaopo__c = true];
- map<id, id> poidmap = new map<id,id>();
- set<id> lpoids = new set<id>();
- note[] newNotes = new list<note>();
- if(lpo.size()>0) {
- for(mev_PO_Requisition__c po: lpo) {
- poidmap.put(po.ao_po_id__c,po.id);
- lpoids.add(po.ao_po_id__c);
- }
- notes = [select id, parentid, title, isprivate, body, ownerid from note where parentid in :lpoids];
- if (notes.size()>0) {
- for(note n: notes) {
- id tmpid = poidmap.get(n.parentid);
- note nn = new note(parentid=tmpid,title=n.title,isprivate=n.isprivate,body=n.body,ownerid=n.ownerid);
- newNotes.add(nn);
- }
- insert newNotes;
- }
- }
Add Comment
Please, Sign In to add comment