///
        /// Create an user custom field.
        /// If the custom field already existed then update it.
        ///
        ///
        /// @param customFieldValue
        /// @return user custom field id
        /// @throws com.silanis.esl.sdk.EslException
        ///
        public CustomFieldValue SubmitCustomFieldValue(CustomFieldValue customFieldValue)
        {
            UserCustomField apiCustomFieldValue = customFieldValue.toAPIUserCustomField();

            apiCustomFieldValue = apiClient.SubmitCustomFieldValue(apiCustomFieldValue);
            return(CustomFieldValueBuilder.CustomFieldValue(apiCustomFieldValue).build());
        }
Exemple #2
0
        ///
        /// Create an user custom field.
        /// If the custom field already existed then update it.
        ///
        ///
        /// @param customFieldValue
        /// @return user custom field id
        /// @throws com.silanis.esl.sdk.EslException
        ///
        public CustomFieldValue SubmitCustomFieldValue(CustomFieldValue customFieldValue)
        {
            string path = template.UrlFor(UrlTemplate.USER_CUSTOMFIELD_PATH).Build();
            string response;

            try {
                string payload = JsonConvert.SerializeObject(customFieldValue.toAPIUserCustomField(), settings);
                if (DoesCustomFieldValueExist(customFieldValue.Id))
                {
                    response = client.Put(path, payload);
                }
                else
                {
                    response = client.Post(path, payload);
                }
                UserCustomField result = JsonConvert.DeserializeObject <UserCustomField>(response);

                return(CustomFieldValueBuilder.CustomFieldValue(result).build());
            } catch (Exception e) {
                throw new EslException("Could not add/update the custom field to account." + e.Message);
            }
        }
     ///
      /// Create an user custom field.
      /// If the custom field already existed then update it.
      ///
      ///
      /// @param customFieldValue
      /// @return user custom field id
      /// @throws com.silanis.esl.sdk.EslException
      ///
     public CustomFieldValue SubmitCustomFieldValue( CustomFieldValue customFieldValue ) {
         string path = template.UrlFor(UrlTemplate.USER_CUSTOMFIELD_PATH).Build();
         string response;
 
         try {
         
             string payload = JsonConvert.SerializeObject(customFieldValue.toAPIUserCustomField(), settings);
             if ( DoesCustomFieldValueExist( customFieldValue.Id )){
                 response = client.Put(path,payload);
             }else{
                 response = client.Post(path, payload);
             }
             UserCustomField result = JsonConvert.DeserializeObject<UserCustomField>(response);
 
             return CustomFieldValueBuilder.CustomFieldValue( result ).build();
         } catch ( Exception e ) {
             throw new EslException( "Could not add/update the custom field to account." + e.Message );
         }
     }
		///
		/// Create an user custom field.
		/// If the custom field already existed then update it.
		///
		///
		/// @param customFieldValue
		/// @return user custom field id
		/// @throws com.silanis.esl.sdk.EslException
		///
		public CustomFieldValue SubmitCustomFieldValue(CustomFieldValue customFieldValue)
        {   
            UserCustomField apiCustomFieldValue = customFieldValue.toAPIUserCustomField();
            apiCustomFieldValue = apiClient.SubmitCustomFieldValue(apiCustomFieldValue);
            return CustomFieldValueBuilder.CustomFieldValue(apiCustomFieldValue).build();
        }