Symptoms
When a blueprint with custom form is requested, you see these errors:
Some data cannot be retrieved. If the problem persists, contact your system administrator.; [1][vSphere__vCenter__Machine_1~CustomNetwork.valueList][com.vmware.vra.networks/getApplicableNetworks] Error occurred executing action. Error: [Unable to start action 'com.vmware.vra.networks/getApplicableNetworks'. Reason 'Action 'getApplicableNetworks' in module 'com.vmware.vra.networks' failed : Supplied tenant 'null' is different from the token's tenant 'qe' (unnamed script#7)'.] Some data cannot be retrieved. If the problem persists, contact your system administrator.; [1][macOS_10.13.3~ReservationPolicyID.valueList][com.vmware.vra.reservations/getApplicableReservationPolicies] Error occurred executing action. Error: [Unable to start action 'com.vmware.vra.reservations/getApplicableReservationPolicies'. Reason 'Action 'getApplicableReservationPolicies' in module 'com.vmware.vra.reservations' failed : Supplied tenant 'null' is different from the token's tenant 'applebuild' (unnamed script#9)'.]
Cause
This issue occurs because the vRA system context parameters starting with "__asd_" are not passed to vRO action when it is called from a custom request form and null value is returned when System.getContext().getParameter("__asd_tenantRef"); function is used in vRO action scripting.
Resolution
To resolve this issue, modify the vRO action that uses system context parameters so that needed information is passed as actual action parameters instead of retrieving them from the system context. Then when choosing the action in forms designer, it is possible to bind action parameters to request info parameters.This is step by step example for com.vmware.vra.networks/getApplicableNetworks vRO action:
Duplicate the getApplicableNetworks vRO action using vRO client.Replace all scripting variables that are retrieved from action's system context with explicit action parameter declaration. For instance, replace the following line: var blueprint = System.getContext().getParameter("__asd_tenantRef"); with creation of action parameter with name "tenantRef". Navigate to the custom forms designer (Blueprints > Custom Form > Edit).On the applicableNetworks dropdown field, select the customized action as Value Options external source. Set parameters bindings as follows: blueprint = <enter the blueprintId as a constant> component = <enter the component as a constant, e.g: vSphere__vCenter__Machine_1> tenant = <bind to Tenant reference> user= <bind to Requested For> subtenantId = < bind to Subtenant reference> Save the custom request form.