cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

User type in cpq responsive template

tdhirendra3221
Explorer
0 Likes
1,126

I'm unable to read user type in cpq responsive template. I want to disable some custom field for particular user type but couldn't read user type.

Do we have any standard way to access user type in responsive template.

In side script tag I'm using

Var userType='@UserEnvironment.Curren.User.UserType.Name'

But it breaks development system doesn't even run ..

Thanks

Manku

Accepted Solutions (1)

Accepted Solutions (1)

MaxGag
Participant
0 Likes

Hello,

I just find in the template Shared/MainMenu that they use @UserEnvironment that provide current user data.

I' haven't check but maybe the userType is available.

Thanks

tdhirendra3221
Explorer
0 Likes
Hi maxgag2 ,

I contacted sap architect for the soltuon that is exactly what you have mentioned

userType='@UserEnvironment.Curren.User.UserType.Name

Only part I wasn't aware of that.. this userType variable was global....

Thanks

Answers (2)

Answers (2)

MaxGag
Participant
0 Likes

Hello,

1 - Have you check the OOTB permission feature on custom fields? You can put field permission depending of the user type and quote status without doing anything on UI (see screenshot).

2 - Or as Prithvi said you can use a script and check the current user user type.

if xxx:

Quote.GetCustomField('YourFieldName').Visible = False

3 - Last way to do it is to create a custom template with your field set as visible:false then instead of setting the template as default, just add it on the user type you want.

Thanks

tdhirendra3221
Explorer
0 Likes

Hi maxgag2 ,

Thanks for your response ,

1. This OOTB permission feature on custom fields i haven't explored it . this OOTB seems cart item administrator where we define editability for cart item custom field and Quote custom calculation ., i will explore this option in my instance .

Can we define here editability for normal custom field ?

2. due to some restriction I'm not allowed to use global script .

3.This is exactly I'm trying to achieve and somewhat i have implemented also only problem I have ie I'm unable to put user type condition because I don't know how to access it

Thanks
Manku

MaxGag
Participant
0 Likes

Hello,

1- The permission are directly on the custom field edition page for quote fields and no you can't define editability for regular fields. For quote Item custom fields, it's manageable in Cart field administration.

3- For Responsive template, you don't need to use a condition in your template. You need to have 2 or more different templates. The one with the field visibility restriction (no need to have a condition), need to be set as user type UI template in the User Type section. All other user type will see the default template.

Thanks

mpr1023
Participant
0 Likes

Hi Manku,

To disallow a custom field instead of making changes in UI, You can write a Global script attaching a event. This helps you I guess !

tdhirendra3221
Explorer
0 Likes

Hi mpr1023 ,

Thanks for quick response , I understand , we can use custom field property [editability ] in global script to disable it .

It would be quite easy to read user type also in global script .

But in my instance if i change any custom field then i need to click on save{Quote.Save()} button in order to trigger the event[if i have any event for that custom field].

As per requirement user should get idea what all possible selection he can make in another custom field , while changing one custom field value. he should not wait to click save button to trigger the event .

I think it can be done via knockout js in ui side .but my problem is I'm unable to read the user type in responsive template .

to summarize my problem :

suppose there is two custom field CF A , B both are type dropdown .

1.If user select any value in CF A then based on user type i need to enable and disabled CF B ,but yes without clicking on save

Thanks

Manku