Populate the attribute values in a predefined character size and position

rajeshg
New Contributor
New Contributor

Hi ,

 

Please refer below mentioned details.

Connection Details: Mainframe_LDAPGateway_TopSecret

Usecase:

We would need to populate the below concatenated attributes to mainframe account attribute “INSTDATA”. The requirement is to send values with the exact character position.

GEAC,username,Jobclass,First lsatname,DEPT ACID,SUBGROUP, CADOPID

Position of the Character:

1-4     GEAC

5        ,

6-12    Username

13        ,

14-21    Jobclass

22        ,

23-32    FIRST LAST

33        ,

34-38    DEPT ACID

39        ,

40-44    SUBGROUP

45        ,

46-51    CADOPID

For example:

The  JobClass attribute value character is “8 characters”. If we receive job class as “LEAD” which is 4 characters and it should need to send to target application account as “LEADXXXX” here ‘X’ is space, here LEAD is 4 characters and space is 4 characters. And the value should sit exactly the mentioned positions between 14th to 21.

We have tried to concatenate with couple of scenarios but it was sent without adding space incase of attribute value is not fulfilling the required characters.

Regards,

Rajesh

13 REPLIES 13

rushikeshvartak
All-Star
All-Star

Share current json 


Regards,
Rushikesh Vartak
If the response is helpful, please click Accept As Solution and kudos it.

Hi Rushikesh,

I was trying with some test JSON and refer below.

"INSTDATA": "${'user.customproperty19'+''.substring(0,5)-(user.customproperty19.length())}"

Regards,

Rajesh

rajeshg
New Contributor
New Contributor

Hi 

Any update on this?

SB
Saviynt Employee
Saviynt Employee

Can you try with the below and see if it works for you.

\"${String cp = user.customproperty19; cp = cp.padRight(8,' '); return cp}\"

And in case we also need the substring, we can use format as below

\"${String cp = user.customproperty19; cp = cp.substring(14,21).padRight(8,' '); return cp}\"


Regards,
Sahil

rajeshg
New Contributor
New Contributor

Hi Sahil,

Thanks for your reply. 

The use case is not only sending value to target attribute also would need place in the exact character place.

The  JobClass attribute value character is “8 characters”. If we receive job class as “LEAD” which is 4 characters and it should need to send to target application account as “LEADXXXX” here ‘X’ is space, here LEAD is 4 characters and space is 4 characters. And the value should sit exactly the mentioned positions between 14th to 21 with 8 characters including space.

 

Regards,

Rajesh

SB
Saviynt Employee
Saviynt Employee

I am not sure what you mean when you say the value should sit exactly at the position between 14 to 21. Can you elaborate on this.


Regards,
Sahil

rajeshg
New Contributor
New Contributor

Hi Sahil,

We have requirement to send the groups of attribute values to target application field (INSTADATA) with exact character position.

For example:

GEAC,username,Jobclass,First lsatname,DEPT ACID,SUBGROUP, CADOPID

Position of the Character:

1-4     GEAC - This value should be placed between character position 1 to 4.

5        ,     5th character position should be "comma"(,)

6-12    Username  ---  Username value should be placed exactly between 6-12 characters. For example username value length is only 4 characters so remaining position should be empty.

13        ,

14-21    Jobclass

22        ,

23-32    FIRST LAST

33        ,

34-38    DEPT ACID

39        ,

40-44    SUBGROUP

45        ,

46-51    CADOPID

 

Regards,
Rajesh

SB
Saviynt Employee
Saviynt Employee

Can you share the postman export of this call and the current JSON you are using in Saviynt.


Regards,
Sahil

rajeshg
New Contributor
New Contributor

Hi @SB 

We are not doing any postman exercise etc. The use case and JOSN which is tried is mentioned in the same trail.

Can we have quick call on this to explore the possible solutions for this use case.

Regards,
Rajesh

SB
Saviynt Employee
Saviynt Employee

If this a REST Based connection, we should test it first from postman. And then for it to work from Saviynt, we will need the postman payload to help with the JSON construction.

This is a community forum and a call will not be possible. You can reach out to your CSM for PS help or if a call is needed for discussion around the use case.


Regards,
Sahil

amit_krishnajit
Saviynt Employee
Saviynt Employee

It seems that you want to be able to calculate the value of one of the attributes where the position of certain text remains intact. You may want to try to form the Groovy expression for that attribute into the following manner

'GEAC'.concat(',').concat(user?.username?.length()<7 ? user?.username.concat(String.format("%"+(7-user?.username?.length())+"s", "").replace(' ', 'X')) : username?.substring(0,7)).concat(',').concat(user?.jobCode?.length()<7 ? user?.jobCode?.concat(String.format("%"+(7-user?.jobCode?.length())+"s", "").replace(' ', 'X')) : user?.jobCode?.substring(0,7))

 

 

Thanks,
Amit

rajeshg
New Contributor
New Contributor

Hi Amit,

Thanks for your response. We have tested only for username by taking from the given syntax.

The given syntax is not working and errored out.

Error while creating account in AD - No such property: username for class: SimpleTemplateScript999Checking DN for uid=ts001221,ou=People,dc=tops,dc=com.Not FOund DN for uid=ts001221,ou=People,dc=tops,dc=com.

I removed the syntax and tried the task completed successfully.

The user case is to place the attribute values in exact position with defined number of characters.

The  JobClass attribute value character is “8 characters”. If we receive job class as “LEAD” which is 4 characters and it should need to send to target application account as “LEADXXXX” here ‘X’ is space, here LEAD is 4 characters and space is 4 characters so "LEAD    ". And the value should sit exactly the mentioned positions between 14th to 21 with 8 characters including space.

 

 

 

 

Can you share the portion of the JSON where you are using this?

 

Thanks,
Amit