cancel
Showing results for 
Search instead for 
Did you mean: 

rest task-forms save-form dropdown

kdevineni1
Champ on-the-rise
Champ on-the-rise

I am new to this forms, playing around.

My task form has drop down control (form control snippet)

 {
                        "fieldType": "RestFieldRepresentation",
                        "id": "dropOffLocation",
                        "name": "",
                        "type": "dropdown",
                        "value": "Choose one...",
                        "required": false,
                        "readOnly": false,
                        "overrideId": true,
                        "colspan": 1,
                        "placeholder": null,
                        "minLength": 0,
                        "maxLength": 0,
                        "minValue": null,
                        "maxValue": null,
                        "regexPattern": null,
                        "optionType": "manual",
                        "hasEmptyValue": true,
                        "options": [
                            {
                                "id": "empty",
                                "name": "Choose one..."
                            },
                            {
                                "id": "option_1",
                                "name": "New York"
                            },
                            {
                                "id": "option_2",
                                "name": "New Jersey"
                            }
                        ],
                        "restUrl": null,
                        "restResponsePath": null,
                        "restIdProperty": null,
                        "restLabelProperty": null,
                        "tab": null,
                        "className": null,
                        "params": {
                            "existingColspan": 1,
                            "maxColspan": 1
                        },
                        "dateDisplayFormat": null,
                        "layout": {
                            "row": -1,
                            "column": -1,
                            "colspan": 1
                        },
                        "sizeX": 1,
                        "sizeY": 1,
                        "row": -1,
                        "col": -1,
                        "visibilityCondition": null,
                        "endpoint": null,
                        "requestHeaders": null
                    }

Using rest api I am trying to set the value for the dropdown.

api/enterprise/task-forms/:taskId/save-form

{
  "values": {
     "firstName" : "test1",
     "lastName"  : "Test3",
     "dropOffLocation" : "option_1"
   }
}

I was able to set the text field values(firstName and lastName, but not the dropdown(select) values.

What would be format for setting the dropdown values ?

Thanks in advance.

1 ACCEPTED ANSWER

sanjaybandhaniya
Elite Collaborator
Elite Collaborator

Hi,

You need to provide id and name of option.

Ex.

{
  "values": {
     "firstName" : "test1",
     "lastName"  : "Test3",
      "country": 
    	{
    		"id": "India", 
    		"name": "India"
    		
    	}
   }
}

View answer in original post

4 REPLIES 4

sanjaybandhaniya
Elite Collaborator
Elite Collaborator

Hi,

You need to provide id and name of option.

Ex.

{
  "values": {
     "firstName" : "test1",
     "lastName"  : "Test3",
      "country": 
    	{
    		"id": "India", 
    		"name": "India"
    		
    	}
   }
}

Thank you @sanjaybandhniya

 Is there any document or link explaining the json formats for the different types of form controls 

Whats the format for saving the hyperlink.

I need to update the hyperlink variable from rest call.

EddieMay
World-Class Innovator
World-Class Innovator

Hi @kdevineni1 & welcome to Alfresco,

Thanks for accepting the solution - helpful to others who have a similar issue.

Take care,

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!
Getting started

Explore our Alfresco products with the links below. Use labels to filter content by product module.