Our process automatically creates the Project record when an order is submitted. Is there a way to automatically create/transfer any attachments on the Order record to the Project when it is created?
*This post is locked for comments
Our process automatically creates the Project record when an order is submitted. Is there a way to automatically create/transfer any attachments on the Order record to the Project when it is created?
*This post is locked for comments
You can do this transfer or creation with a plugin STEP imediatelly after the project record was created:
Guid idOrder ="<PUT the context Order GUID>";
Guid idProject = "<PUT the context Project GUID>";
EntityCollection notesFromOrderToProject = GetAnnotations(idOrder);
if(notesFromOrderToProject!=null){
foreach(var note in notesFromOrderToProject.Entities){
Entity annotation= note;
annotation["objectid"] = new EntityReference("<project_entityname>", idProject);
Guid _annotationId = _service.Create(annotation);
}
}
public EntityCollection GetAnnotations(Guid idOrder)
{
QueryByAttribute getAnnotation= new QueryByAttribute("annotation");
getAnnotation.ColumnSet = new ColumnSet(true);
getAnnotation.Attributes.AddRange("objectid");
getAnnotation.Values.AddRange(idOrder);
EntityCollection annotationsList= _service.RetrieveMultiple(getAnnotation);
if (annotationsList.Entities.Count > 0)
return annotationsList;
return null;
}
If this solves, please Like an mark as "Verified Answer"
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,214 Most Valuable Professional
nmaenpaa 101,156