1

I am trying to display a field in editview alone based on a fieldvale in userdetails.

Ex: For an user can_add_no will be in user details, if it is checked than that particular user can add a quote_extra_no in quote module.

I tried the following. Added dependency for the quote module for the field.

$dictionary['Quote']['fields']['quote_extra_no'] = array (
    'audited'                   => true,
    'calculated'                => false,
    'duplicate_merge'           => 'disabled',
    'duplicate_merge_dom_value' => '0',
    'importable'                => 'true',
    'len'                       => '255',
    'massupdate'                => false,
    'merge_filter'              => 'disabled',
    'name'                      => 'quote_extra_no',
    'no_default'                => true,
    'reportable'                => true,
    'required'                  => false,
    'size'                      => '50',
    'source'                    => 'custom_fields',
    'studio'                    => 'visible',
    'type'                      => 'varchar',
    'unified_search'            => false,
    'vname'                     => 'LBL_EXTRA_REF',
    'dependency'                => 'equal(related($assigned_user_link,"can_add_no"),"1")',
);

Also added the field in Editview. But its not working. If the current user can_add_no is set or checkbox is ticked. He can Edit the quote_extra_no in the editview of the quote.

How can i achive the functionality as the dependency is not helping me to do it.

DonOfDen
  • 3,968
  • 11
  • 62
  • 112
  • Your formula suggests that it is the assigned user of the quote, not the current user. Can you please confirm whether it's the current user, or the assigned user that needs to have that property? – Reisclef Jan 24 '17 at 20:00
  • Assigned user @Reisclef – DonOfDen Jan 25 '17 at 05:02
  • Okay, so is it only if the current user is the assigned user, and said user has can_add_no ticked? If so, it's possible through a custom view. If you can't solve it from the existing answer, I'll see if I can help further. – Reisclef Jan 25 '17 at 19:07

1 Answers1

1

There are two may to do that for both way you should have relation between both module.

  1. By Using Dependency :

    equal(related($related_field_name,"can_add_no"),"1")'

  2. IN record.js write a method in that method call a api for canadd_no and according to that show hide the field.

API call Example :

  app.api.call('read', app.api.buildURL(this.model.get('_module'), 'read', {id: this.model.get('id')}), null,
                {
                    success: function(data) {
                          your costume code to hide
                        }
                    },
                });

More Info related to API

Amitesh Kumar
  • 3,051
  • 1
  • 26
  • 42