SetMultiLangDescription

You can use the SetMultiLangDescription function to update multilingual descriptions for header and detail fields.

When to use

You can use this function to:

  • Update multilingual descriptions for object fields.
  • Implement translation management workflows.

Syntax

Syntax 1
Update Header Field for Specific Language.
void SetMultiLangDescription(string sourceSymbol, string sourceSymbolCode, string languageCode, string sourceField, string sourceFieldValue)
Parameter
Parameter Type Required Description
sourceSymbol string Yes The type of object. For example, "FORMULA", "ITEM", "ACTIONSET".
Note: You can use empty quotation marks "" for current object.
sourceSymbolCode string Yes Object key code.
Note:  You can use empty quotation marks "" for current object in workflow context.
languageCode string Yes The language code for which to update the value. For example, "FR-FR", "DE-DE", "ES-ES".
sourceField string Yes The field name for which the multi-language value is to be updated.
sourceFieldValue string Yes The multi-language value to set for the specified field.
Syntax 2
Update Header Fields Using Field-Value String.
void SetMultiLangDescription(string sourceSymbol, string sourceSymbolCode, string sourceFieldsandValues)
Parameter
Parameter Type Required Description
sourceSymbol string Yes The type of object. For example, "FORMULA", "ITEM", "ACTIONSET".
Note: You can use empty quotation marks "" for current object.
sourceSymbolCode string Yes Object key code.
Note:  You can use empty quotation marks "" for current object in workflow context.
sourceFieldsandValues string Yes String containing field names and values in a specific format
Example 1
SetMultiLangDescription("", "", "FR-FR", "DESCRIPTION", "FR-FR description updated using SetMultiLangDescription");
Description
This is an example to set the description for the current symbol and current object for a language of FR-FR for description with FR-FR description updated using SetMultiLangDescription.
Syntax 3
Update Detail Grid Field for Specific Language and Line ID.
void SetMultiLangDescription(string sourceSymbol, string sourceSymbolCode, string dtlCode, string languageCode, int sourceLineId, string sourceField, string sourceFieldValue)
Parameter
Parameter Type Required Description
sourceSymbol string Yes The symbol of object.
Note: You can use empty quotation marks "" for current object.
sourceSymbolCode string Yes The object key code.
Note: You can use empty quotation marks "" for current object in workflow context.
dtlCode string Yes The detail code (DTLCODE) of the tab/section containing the multi-language column. For example, "LINE", "INGR", "TPALL".
languageCode string Yes The language code for the multi-language value. for example, "FR-FR", "DE-DE".
sourceLineId int Yes The Line ID of the row in the detail grid for which to update the multi-language value.
sourceField string Yes The field name for which the multi-language value is to be updated.
sourceFieldValue string Yes The multi-language value to set.
sourceFieldsandValues string Yes String containing field names and values in a specific format
Example 2
SetMultiLangDescription("ACTIONSET", "SFTEST1", "LINE", "FR-FR", 1, "DESCRIPTION", "FR-FR description");
Description
This example updates the multi-lang description for Line id 1 in the Steps table of Action set SFTEST1.
Note: LINE is the detail code related to the steps table of Action Set form.
Syntax 4
void SetMultiLangDescription(string sourceSymbol, string sourceSymbolCode, string dtlCode, Dictionary<int, MultiLangData[]> dtlLangData)
Parameter
Parameter Type Required Description
sourceSymbol string Yes The symbol of object.
Note: You can use empty quotation marks "" for current object.
sourceSymbolCode string Yes The object key code.
Note: You can use empty quotation marks "" for current object in workflow context.
dtlCode string Yes The detail code (DTLCODE) of the tab/section containing the multi-language column. For example, "LINE", "INGR", "TPALL".
dtlLangData Dictionary<int, MultiLangData[]> Yes The dictionary containing language data where key is Line ID and value is array of MultiLangData objects.
Example 3
Add multi-language descriptions to detail rows.
// Source symbol / code
string sourceSymbol = "ACTIONSET";
string sourceSymbolCode = "SFTEST1";
string sourceField = "DESCRIPTION";

// Dictionary mapping row key -> array of MultiLangData
var dtlLangData = new Dictionary<int, Optiva.ScriptProxy.MultiLangData[]>();

// Row 2 data (two languages)
var sourceFieldsandValues = new Optiva.ScriptProxy.MultiLangData[2];
sourceFieldsandValues[0] = new Optiva.ScriptProxy.MultiLangData
{
    languageCode = "EN-US",
    multiLangField = "DESCRIPTION",
    description = "description in EN-US for row 2"
};
sourceFieldsandValues[1] = new Optiva.ScriptProxy.MultiLangData
{
    languageCode = "FR-FR",
    multiLangField = "DESCRIPTION",
    description = "description in FR-FR for row 2"
};
dtlLangData.Add(2, sourceFieldsandValues);

// Row 3 data (two languages)
var sourceFieldsandValuesRow3 = new Optiva.ScriptProxy.MultiLangData[2];
sourceFieldsandValuesRow3[0] = new Optiva.ScriptProxy.MultiLangData
{
    languageCode = "EN-US",
    multiLangField = "DESCRIPTION",
    description = "description in EN-US for row 3"
};
sourceFieldsandValuesRow3[1] = new Optiva.ScriptProxy.MultiLangData
{
    languageCode = "FR-FR",
    multiLangField = "DESCRIPTION",
    description = "description in FR-FR for row 3"
};
dtlLangData.Add(3, sourceFieldsandValuesRow3);

// Call the API / helper - replace 'dtlCode' with the appropriate integer detail code
int dtlCode = /* your detail code here */;
SetMultiLangDescription(sourceSymbol, sourceSymbolCode, dtlCode, dtlLangData);
Description
This is an example to set the description for ACTIONSET with set code SFTEST1 in Steps tab.

Return Value

The application returns a value zero (0) is successful and -1 if there is an error.

Impact

  • The multi language field values are updated in the database.
  • The changes are immediately persisted.

Prerequisites

  • The fields must support multi language values.
  • The language codes must be valid and supported.

Edge Cases

The empty quotes for objSymbol and objKey target the current workflow object.