Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. List<id> lstAssetIds= new List<id>();
  2. lstAssetIds.Add('aaaaaaaaaaaaaaaaa');
  3. List<Asset_DMSFolder__c> AssetFolders = [select Id,DMS_Folder__r.Name,Asset__r.Name,Asset__r.Id from Asset_DMSFolder__c where Asset__c IN: lstAssetIds];
  4.  
  5. AssetFolders[0].DMS_Folder__r.Name = 'renameusingchild';
  6. update AssetFolders;
  7. // the above update does not change the folder name to renameusingchild
  8. System.debug([select Id,DMS_Folder__r.Name,Asset__r.Name,Asset__r.Id from Asset_DMSFolder__c where Asset__c IN: lstAssetIds][0].DMS_Folder__r.Name);
  9.  
  10. ContentFolder cf = [select Id from ContentFolder where Id =:AssetFolders[0].DMS_Folder__c ];
  11. cf.Name = 'testdirectobjupdate';
  12. update cf;
  13. System.debug([select Id,DMS_Folder__r.Name,Asset__r.Name,Asset__r.Id from Asset_DMSFolder__c where Asset__c IN: lstAssetIds][0].DMS_Folder__r.Name);
  14. //the above update works
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement