Skip to content

Latest commit

 

History

History
432 lines (322 loc) · 21.6 KB

File metadata and controls

432 lines (322 loc) · 21.6 KB

CustomFields

Overview

Custom Fields are created by event planners to track important information about specific objects like events, contacts, or sessions. Use these APIs to view, create, and update custom fields in your account and their related details.

Available Operations

ListCustomFields

Get a paginated list of custom fields in an account.

More about OAuth2 authorization code support for administrators <#oauth2-auth-code-planner-admin>

Example Usage

using Cvent.SDK;
using Cvent.SDK.Models.Components;
using Cvent.SDK.Models.Requests;
using System;

var sdk = new CventSDK(security: new Security() {
    OAuth2ClientCredentials = new SchemeOAuth2ClientCredentials() {
        ClientID = "<YOUR_CLIENT_ID_HERE>",
        ClientSecret = "<YOUR_CLIENT_SECRET_HERE>",
        TokenURL = "<YOUR_TOKEN_URL_HERE>",
        Scopes = "<YOUR_SCOPES_HERE>",
    },
});

ListCustomFieldsRequest req = new ListCustomFieldsRequest() {
    After = System.DateTime.Parse("2017-01-02T02:00:00Z").ToUniversalTime(),
    Before = System.DateTime.Parse("2017-01-02T02:00:00Z").ToUniversalTime(),
    Token = "0e28af57-511f-47ab-ae46-46cd1ca51a1a",
    Filter = "category eq 'Event' and lastModified gt '2021-03-19T11:30:37.909Z' and code eq 'FAVORITE_COLOR_CODE'",
};

ListCustomFieldsResponse? res = await sdk.CustomFields.ListCustomFieldsAsync(req);

while(res != null)
{
    // handle items

    res = await res.Next!();
}

Parameters

Parameter Type Required Description
request ListCustomFieldsRequest ✔️ The request object to use for the request.

Response

ListCustomFieldsResponse

Errors

Error Type Status Code Content Type
Cvent.SDK.Models.Errors.ErrorResponse1 400, 401, 403, 429 application/json
Cvent.SDK.Models.Errors.APIException 4XX, 5XX */*

CreateCustomField

Creates a single custom field based on the values provided.

More about OAuth2 authorization code support for administrators <#oauth2-auth-code-planner-admin>

Example Usage

using Cvent.SDK;
using Cvent.SDK.Models.Components;

var sdk = new CventSDK(security: new Security() {
    OAuth2ClientCredentials = new SchemeOAuth2ClientCredentials() {
        ClientID = "<YOUR_CLIENT_ID_HERE>",
        ClientSecret = "<YOUR_CLIENT_SECRET_HERE>",
        TokenURL = "<YOUR_TOKEN_URL_HERE>",
        Scopes = "<YOUR_SCOPES_HERE>",
    },
});

CustomField3 req = new CustomField3() {
    Category = CustomFieldCategory.Contact,
    Name = "What is a your favorite color?",
    Code = "FAVORITE_COLOR_CODE",
    Type = CustomFieldType2.OpenEndedTextOneLine,
    Details = CustomField3Details.CreateOpenEndedOneLine(
        new OpenEndedOneLine() {
            AnswerFormat = "General",
            Minimum = 2,
            Maximum = 8,
        }
    ),
    HelpText = "Enter your favorite color.",
    DefaultTagText = "Your Division",
};

var res = await sdk.CustomFields.CreateCustomFieldAsync(req);

// handle response

Parameters

Parameter Type Required Description
request CustomField3 ✔️ The request object to use for the request.

Response

CreateCustomFieldResponse

Errors

Error Type Status Code Content Type
Cvent.SDK.Models.Errors.ErrorResponse1 400, 401, 403, 429 application/json
Cvent.SDK.Models.Errors.APIException 4XX, 5XX */*

UpdateCustomField

Updates a custom field based on the given custom field ID.

More about OAuth2 authorization code support for administrators <#oauth2-auth-code-planner-admin>

Example Usage

using Cvent.SDK;
using Cvent.SDK.Models.Components;
using Cvent.SDK.Models.Requests;
using System.Collections.Generic;

var sdk = new CventSDK(security: new Security() {
    OAuth2ClientCredentials = new SchemeOAuth2ClientCredentials() {
        ClientID = "<YOUR_CLIENT_ID_HERE>",
        ClientSecret = "<YOUR_CLIENT_SECRET_HERE>",
        TokenURL = "<YOUR_TOKEN_URL_HERE>",
        Scopes = "<YOUR_SCOPES_HERE>",
    },
});

UpdateCustomFieldRequest req = new UpdateCustomFieldRequest() {
    CustomFieldId = "04ca6ae2-0dc3-487b-953e-86d6abbdf7d3",
    ExistingCustomField = new ExistingCustomFieldInput() {
        Category = CustomFieldCategory.Contact,
        Name = "What is a your favorite color?",
        Code = "FAVORITE_COLOR_CODE",
        Type = CustomFieldType2.OpenEndedTextOneLine,
        Details = ExistingCustomFieldDetailsInput.CreateChoices1Input(
            new Choices1Input() {
                Choices = new List<Choice2Input>() {
                    new Choice2Input() {
                        Text = "What is your current designation?",
                    },
                },
            }
        ),
        HelpText = "Enter your favorite color.",
        DefaultTagText = "Your Division",
    },
};

var res = await sdk.CustomFields.UpdateCustomFieldAsync(req);

// handle response

Parameters

Parameter Type Required Description
request UpdateCustomFieldRequest ✔️ The request object to use for the request.

Response

UpdateCustomFieldResponse

Errors

Error Type Status Code Content Type
Cvent.SDK.Models.Errors.ErrorResponse1 400, 401, 403, 404, 429 application/json
Cvent.SDK.Models.Errors.APIException 4XX, 5XX */*

GetCustomField

Get a single custom field based on the given custom field ID.

More about OAuth2 authorization code support for administrators <#oauth2-auth-code-planner-admin>

Example Usage

using Cvent.SDK;
using Cvent.SDK.Models.Components;
using Cvent.SDK.Models.Requests;

var sdk = new CventSDK(security: new Security() {
    OAuth2ClientCredentials = new SchemeOAuth2ClientCredentials() {
        ClientID = "<YOUR_CLIENT_ID_HERE>",
        ClientSecret = "<YOUR_CLIENT_SECRET_HERE>",
        TokenURL = "<YOUR_TOKEN_URL_HERE>",
        Scopes = "<YOUR_SCOPES_HERE>",
    },
});

GetCustomFieldRequest req = new GetCustomFieldRequest() {
    CustomFieldId = "04ca6ae2-0dc3-487b-953e-86d6abbdf7d3",
};

var res = await sdk.CustomFields.GetCustomFieldAsync(req);

// handle response

Parameters

Parameter Type Required Description
request GetCustomFieldRequest ✔️ The request object to use for the request.

Response

GetCustomFieldResponse

Errors

Error Type Status Code Content Type
Cvent.SDK.Models.Errors.ErrorResponse1 401, 403, 404, 429 application/json
Cvent.SDK.Models.Errors.APIException 4XX, 5XX */*

UpdateCustomFieldAdvancedLogic

Updates the advanced logic for a custom field. Links the field given in the path to a 'source' custom field. Answers to the source custom field determine the visible choices in the given custom field. If the source field has no answers, only the default choices for the given field are visible.

More about OAuth2 authorization code support for administrators <#oauth2-auth-code-planner-admin>

Example Usage

using Cvent.SDK;
using Cvent.SDK.Models.Components;
using Cvent.SDK.Models.Requests;

var sdk = new CventSDK(security: new Security() {
    OAuth2ClientCredentials = new SchemeOAuth2ClientCredentials() {
        ClientID = "<YOUR_CLIENT_ID_HERE>",
        ClientSecret = "<YOUR_CLIENT_SECRET_HERE>",
        TokenURL = "<YOUR_TOKEN_URL_HERE>",
        Scopes = "<YOUR_SCOPES_HERE>",
    },
});

UpdateCustomFieldAdvancedLogicRequest req = new UpdateCustomFieldAdvancedLogicRequest() {
    CustomFieldId = "04ca6ae2-0dc3-487b-953e-86d6abbdf7d3",
    AdvancedLogic = new AdvancedLogic() {
        SourceCustomFieldId = "010ad823-4cc2-4b78-8fbd-30b63ed0229d",
    },
};

var res = await sdk.CustomFields.UpdateCustomFieldAdvancedLogicAsync(req);

// handle response

Parameters

Parameter Type Required Description
request UpdateCustomFieldAdvancedLogicRequest ✔️ The request object to use for the request.

Response

UpdateCustomFieldAdvancedLogicResponse

Errors

Error Type Status Code Content Type
Cvent.SDK.Models.Errors.ErrorResponse1 400, 401, 403, 404, 429 application/json
Cvent.SDK.Models.Errors.APIException 4XX, 5XX */*

CreateCustomFieldTranslation

Creates translations for a single custom field based on the values provided.

More about OAuth2 authorization code support for administrators <#oauth2-auth-code-planner-admin>

Example Usage

using Cvent.SDK;
using Cvent.SDK.Models.Components;
using Cvent.SDK.Models.Requests;
using System.Collections.Generic;

var sdk = new CventSDK(security: new Security() {
    OAuth2ClientCredentials = new SchemeOAuth2ClientCredentials() {
        ClientID = "<YOUR_CLIENT_ID_HERE>",
        ClientSecret = "<YOUR_CLIENT_SECRET_HERE>",
        TokenURL = "<YOUR_TOKEN_URL_HERE>",
        Scopes = "<YOUR_SCOPES_HERE>",
    },
});

CreateCustomFieldTranslationRequest req = new CreateCustomFieldTranslationRequest() {
    CustomFieldId = "04ca6ae2-0dc3-487b-953e-86d6abbdf7d3",
    Translation1 = new Translation1() {
        Translation = new Translation() {
            NameTranslation = "Departamento",
            HelpTextTranslation = "El departamento donde trabaja.",
            ChoiceTranslations = new List<ChoiceTranslation>() {
                new ChoiceTranslation() {
                    TranslatedText = "Departamento de Tecnología",
                },
            },
        },
        Language = Language1.Eses,
    },
};

var res = await sdk.CustomFields.CreateCustomFieldTranslationAsync(req);

// handle response

Parameters

Parameter Type Required Description
request CreateCustomFieldTranslationRequest ✔️ The request object to use for the request.

Response

CreateCustomFieldTranslationResponse

Errors

Error Type Status Code Content Type
Cvent.SDK.Models.Errors.ErrorResponse1 400, 401, 403, 404, 429 application/json
Cvent.SDK.Models.Errors.APIException 4XX, 5XX */*

UpdateCustomFieldTranslation

Updates translations for a single custom field based on the given custom field ID.

More about OAuth2 authorization code support for administrators <#oauth2-auth-code-planner-admin>

Example Usage

using Cvent.SDK;
using Cvent.SDK.Models.Components;
using Cvent.SDK.Models.Requests;
using System.Collections.Generic;

var sdk = new CventSDK(security: new Security() {
    OAuth2ClientCredentials = new SchemeOAuth2ClientCredentials() {
        ClientID = "<YOUR_CLIENT_ID_HERE>",
        ClientSecret = "<YOUR_CLIENT_SECRET_HERE>",
        TokenURL = "<YOUR_TOKEN_URL_HERE>",
        Scopes = "<YOUR_SCOPES_HERE>",
    },
});

UpdateCustomFieldTranslationRequest req = new UpdateCustomFieldTranslationRequest() {
    CustomFieldId = "04ca6ae2-0dc3-487b-953e-86d6abbdf7d3",
    Translation1 = new Translation1() {
        Translation = new Translation() {
            NameTranslation = "Departamento",
            HelpTextTranslation = "El departamento donde trabaja.",
            ChoiceTranslations = new List<ChoiceTranslation>() {
                new ChoiceTranslation() {
                    TranslatedText = "Departamento de Tecnología",
                },
            },
        },
        Language = Language1.Eses,
    },
};

var res = await sdk.CustomFields.UpdateCustomFieldTranslationAsync(req);

// handle response

Parameters

Parameter Type Required Description
request UpdateCustomFieldTranslationRequest ✔️ The request object to use for the request.

Response

UpdateCustomFieldTranslationResponse

Errors

Error Type Status Code Content Type
Cvent.SDK.Models.Errors.ErrorResponse1 400, 401, 403, 404, 429 application/json
Cvent.SDK.Models.Errors.APIException 4XX, 5XX */*