Skip to content

Flexable asset fields does not accept new lines for type select #3

Closed

Description

@ecspresso

Trying to create a new flexible asset type with files and when I create a select, new lines are ignored. I tried both \n and rn (the last one worked with contacts in notes).

Here is my code. I tried using options in attributes but it gave me an error, saying I need default_value (should be noted that they used options instead of default_value in their example...). Any ideas?

$body = @{
    data = @{
        type = 'flexible_asset_types'
        attributes = @{
            name = 'Office 365 TEST'
            description = 'Document any Office 365 subscription setup for a customer'
            icon = 'Word'
            show_in_menu = $true
        }
        relationships = @{
            flexible_asset_fields = @{
                data = @(
                    @{
                        type = 'flexible_asset_fields'
                        attributes = @{
                            order = 1
                            name = 'Office 365 subscription type'
                            kind = 'Select'
                            hint = 'What subscription is in use for the customer. You will find it under Office Admin Center, billing.'
                            default_value = 'Office 365 Business\nOffice 365 Business Essentials\nOffice 365 Business Premium\nOffice 365 ProPlus\nOffice 365 Enterprise E1\nOffice 365 Enterprise E3\nOffice 365 Enterprise E5'
                            required = $true
                            show_in_list = $true
                        }
                    }
                )
            }
        }
    }
}

New-ITGlueFlexibleAssetTypes -data $body

Error when using options instead of default_value:

{
  "errors": [
    {
      "source": {
        "pointer": "/data/attributes/flexible-asset-fields.default-value"
      },
      "detail": "can't be blank",
      "title": "Unprocessable Entity",
      "status": 422
    }
  ]
}

Activity

  1. CalebAlbers commented on Feb 5, 2018

    @CalebAlbers
    Contributor
  2. ecspresso commented on Feb 6, 2018

    @ecspresso
    ContributorAuthor

    Solved it buy using double quotes instead of single quotes. I just learned that you cannot use ` inside of single quotes.

    default_value = "Office 365 Business`r`n" `
                  + "Office 365 Business Essentials`r`n" `
                  + "Office 365 Business Premium`r`n" `
                  + "Office 365 ProPlus`r`n" `
                  + "Office 365 Enterprise E1`r`n" `
                  + "Office 365 Enterprise E3`r`n" `
                  + "Office 365 Enterprise E5"
    
  3. CalebAlbers commented on Feb 6, 2018

    @CalebAlbers
    Contributor

    Good catch! I wasn't aware of that.

  4. added a commit that references this issue on Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions