Forum Discussion

keithkelly's avatar
3 years ago

Can I assign signatures to everyone who doesn't have one?

I'd like to - by default - set users' signatures to their name (First Last)

Our users' First & Last names are getting passed in by our IdP/SSO.  I'm under the impression this can't be done automatically, BUT, is it possible to create a script to run periodically that'll do:

for each user{
  if (signature == ""){
    signature = First Last
  }
}

 

If so that'd be sweet

  • keithkelly 
    Here you go with a readymade solution 

    <#assign userIds = [1,2,3] />
    <#list userIds as userId>
        <#assign signature = restadmin('/users/id/${userId}/profiles/name/signature').value />
        <#if signature == "" >
            <#assign first_Name = restadmin('/users/id/${userId}/profiles/name/name_first').value />
            <#assign last_Name = restadmin('/users/id/${userId}/profiles/name/name_last').value />
            <#assign full_name = '${first_Name} ' + '${last_Name}' />
            <#assign response = restadmin('/users/id/${userId}/profiles/name/signature/set?value=${full_name?url}')!{} />
                ${response.@status}
        </#if>
    </#list>

    You can add the IDs in userIds array and run this endpoint in browser. It will - 

    1. Get the current signature 
    2. Check if signature is blank 
    3. if signature is blank, get the first name and last name 
    4. Set the full name in signure field in user profile.