on ‎2021 Apr 05 12:06 PM
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
Request clarification before answering.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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 !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
| User | Count |
|---|---|
| 41 | |
| 4 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.