Guest User

Untitled

a guest
Jan 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. mev_PO_Requisition__c[] lpo = [select id,name,ao_po_id__c,copiedfromaopo__c from mev_PO_Requisition__c where copiedfromaopo__c = true];
  2. map<id, id> poidmap = new map<id,id>();
  3. set<id> lpoids = new set<id>();
  4. note[] newNotes = new list<note>();
  5.  
  6. if(lpo.size()>0) {
  7. for(mev_PO_Requisition__c po: lpo) {
  8. poidmap.put(po.ao_po_id__c,po.id);
  9. lpoids.add(po.ao_po_id__c);
  10. }
  11. notes = [select id, parentid, title, isprivate, body, ownerid from note where parentid in :lpoids];
  12. if (notes.size()>0) {
  13. for(note n: notes) {
  14. id tmpid = poidmap.get(n.parentid);
  15. note nn = new note(parentid=tmpid,title=n.title,isprivate=n.isprivate,body=n.body,ownerid=n.ownerid);
  16. newNotes.add(nn);
  17. }
  18. insert newNotes;
  19. }
  20.  
  21. }
Add Comment
Please, Sign In to add comment