Jump to content
Welcome to our new Citrix community!

Stylebook optional input


Recommended Posts

Hi, I have a simple stylebook to create a server,  I ask for name, IP and comment.

 

Today if the comment field is left blank it will give a error and must be filled in, I would like to have the option to leave it blank, 

does anyone know how to configure it so it will ignore if the filed is left blank?

 

comment is setup like this in the parameters section

  -
    name: comment
    type: string
    label: Server description
    description: Enter description.
    gui:
      updatable: true
    required: false

 

components:
  -
    name: servername
    type: ns::server
    description: Backend server hostname
    properties:
      name: $parameters.hostname 
      ipaddress: $parameters.ip
      comment: $parameters.comment

Link to comment
Share on other sites

Which version of ADC firmware and ADM version are in use?

 

marking the parameter: required:false should make it optional

BUT the formatting is required to conform to meet requirements; so while its hard to tell in forum post, double check:

1) you are using exact spacing requirements and NOT tabs; parameters must be indented properly which looks like the "required:false value isn't (but that could be an artifact of post to the forum)

2) YAML is case sensitive (shouldn't affect the true/false in this context; but something to keep in mind)

 

Also See optional Properties here:  https://docs.citrix.com/en-us/citrix-application-delivery-management-service/stylebooks/stylebooks-grammar/optional-properties.html

 

References:

https://docs.citrix.com/en-us/citrix-application-delivery-management-service/stylebooks/how-to-use-default-stylebooks.html

https://docs.citrix.com/en-us/citrix-application-delivery-management-service/stylebooks/how-to-create-custom-stylebooks.html

 

The required:false is part of the process.

The second part is in the components invocation, add a "?" to the comment request:

15 hours ago, Rickard Wendel1709162935 said:

components:
  -
    name: servername
    type: ns::server
    description: Backend server hostname
    properties:
      name: $parameters.hostname 
      ipaddress: $parameters.ip
      comment: $parameters.comment

 

Try:

comment?: $parameters.comment

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...