/// <summary> /// Attempt to save me given these contact Ids and this HTML body, taking note of these previous failures. /// </summary> /// <param name="contactIds">CRM ids of contacts to which I should be related.</param> /// <param name="htmlBody">The HTML body with which I should be saved.</param> /// <param name="fails">Any previous failures in attempting to save me.</param> /// <returns>An archive result object describing the outcome of this attempt.</returns> private ArchiveResult TrySave(List <string> contactIds, string htmlBody, Exception[] fails) { var restServer = SuiteCRMUserSession.RestServer; var emailResult = restServer.GetCrmResponse <RESTObjects.SetEntryResult>("set_entry", ConstructPacket(htmlBody)); ArchiveResult result = ArchiveResult.Success(emailResult.id, fails); SaveContacts(contactIds, emailResult); SaveAttachments(emailResult); return(result); }
/// <summary> /// Attempt to save me given these related records and this HTML body, taking note of these previous failures. /// </summary> /// <param name="relatedRecords">CRM module names/ids of records to which I should be related.</param> /// <param name="fails">Any previous failures in attempting to save me.</param> /// <returns>An archive result object describing the outcome of this attempt.</returns> private ArchiveResult TrySave(IEnumerable <CrmEntity> relatedRecords, Exception[] fails) { CrmRestServer restServer = SuiteCRMUserSession.RestServer; SetEntryResult emailResult = restServer.GetCrmResponse <RESTObjects.SetEntryResult>("set_entry", ConstructPacket(this.HTMLBody)); ArchiveResult result = ArchiveResult.Success(emailResult.id, fails); if (result.IsSuccess) { LinkRelatedRecords(relatedRecords, emailResult); SaveAttachments(emailResult); } return(result); }