Use PDIs? Take our 5-minute survey to help shape the PDI roadmap.

「form」ページでカタログ変数を読み取り専用にしたい

hirukawakai
Tera Contributor

ポータル上の「form」ページにあるカタログ変数フィールドを読み取り専用にしたいです。

ログインユーザーやレコードの条件によっては読み取り専用にしないこともあるため、

クライアントスクリプトでの実装を考えています。

 

以下は試してみましたが、うまくいきませんでした。

g_form.setReadOnly('variables.XXX',true);
g_form.setReadOnly('variables',true);

 

g_form.setReadOnly('producer.XXX',true);

 

③(カタログ変数以外は読み取り専用になった)

var fields = g_form.getEditableFields();
for (var i = 0; i < fields.length; i++) {
g_form.setReadOnly(fields[i], true);
}

 

解決策や回避策があれば教えてください。

 

hirukawakai_0-1787107409602.png

 

2件の返信2

Brad Bowman
Mega Patron

The script line you are looking for is:

g_form.setVariablesReadOnly(true); 

and of course make sure the client script applies to the sc_req_item table, or whatever you're calling 'form', and that the UI Type = All

BradBowman_0-1787159560594.png

 

 

 

SAI VENKATESH
Kilo Patron

Hi  @hirukawakai 

If you to make field Read only or Editable based on logged in user in this case you can use g_scratchpad in display business rule and call the scratchpad variable in on load client Script.

Detailed Steps:

  • Create a Display Business Rule.
  • Determine whether the current user should have edit access (your logic needs to come which role or which group needs access)
  • Store the result in g_scratchpad.
  • Access g_scratchpad in an onLoad Client Script.
  • Set the field as read-only or editable.

 

 

 

Thanks and Regards

Sai Venkatesh