Cannot access items on the main page from quick create page - Forum - Rollbase - Progress Community

Cannot access items on the main page from quick create page

 Forum

Cannot access items on the main page from quick create page

This question is answered

I want to access a field value on the main page from a quick create lookup generated from the same page. 

Is there a defined way in rollbase to perform this task?

in following image, number (1) is the value I want to get and number (2) is the place where I want the value

Verified Answer
  • Hi Janani,

    You could achieve this by adding custom script component to Shipment Line Quick create page. You can get values StockOwner and Consignee which were selected in parent page by using our client side API in Qucik create Page and apply filter using rbf_setLookUpFilter API..  

    Add below script to ShipmentLine Quick create page by adding new script component, please update relationship name matches to your object

     <script>

     rb.newui.util.addEventListener('rbs_pageRender',init);

     function init(){

       //Access parent window from popup

       if(window.top){

         var stockOwnerVal = window.top.rbf_getFieldValue('R601101'); //Use relationship name of Stockowner

         var consigneeVal = window.top.rbf_getFieldValue('R601112'); //Use relationship name of consignee

         //Will return array of stock owner

         if(stockOwnerVal && stockOwnerVal.length > 0){

            console.log(stockOwnerVal);

    //TODO , use this stockowner array value to apply lookup filter

         }

         //Will return array of consignee

         if(consigneeVal && consigneeVal.length > 0){

            console.log(consigneeVal);

    //TODO , use this consignee array value to apply lookup filter

         }

       }

     }

     </script>

    I created sample App to demonstrate how to get values from parent page to quick create page and attached same along with this thread for your reference. Please try out and let us know

    Sample Shipment_v2.xml

    Hope this helps,

    Vimal.

All Replies
  • Hi Janani,

    Sorry for delayed response.  Could you explain your use case in details to understand what you are looking for?.

    From your screenshot i could understand you want Save Stock owner information along with Supplier. So you are expecting Stock owner lookup field in the Quick Create dialog of Supplier.  You can achieve this by creating a relationship between supplier and Stock Owner object and select the same supplier that is selected on Receipt creation page or  if you just need need Stock owner name as simple text ( If you don't want to save along with supplier) you could achieve that by writing custom script.

    Please explain your use case in details and what you are looking for .

    Thanks,

    Vimal.

  • Hi Vimal,

    Thanks for your responce.

    This is my use case.

    In Shipment creation, First I will select 'StockOwner' and 'Consignee' on the header level. Then while I create Shipment lines using this Quick create button, I want to filter the articles according to the selected Stockowner and Consignee. For that I need to take their IDs into the QuickCreate page so that I can use the rbf_SetLookupFilter to filter the lookup options.

    Following is one way we found to do this using scripts

    <div id="mydiv"> </div>

    <script>

     var re = /[^-a-zA-Z!,'?\s]/g; // to filter out unwanted characters

       // get reference to greeting text box in containing document

       var fld = parent.document.forms['theForm'].elements['streetAddr1'];

       var val = fld.value.replace(re, '');

       document.getElementById('mydiv').innerHTML = val;

    </script>

    What I want to know is, whether there is a straightforward or easy way to access the data in the background from a quick create page.

    Thanks,

    Janani.

  • Hi Janani,

    You could achieve this by adding custom script component to Shipment Line Quick create page. You can get values StockOwner and Consignee which were selected in parent page by using our client side API in Qucik create Page and apply filter using rbf_setLookUpFilter API..  

    Add below script to ShipmentLine Quick create page by adding new script component, please update relationship name matches to your object

     <script>

     rb.newui.util.addEventListener('rbs_pageRender',init);

     function init(){

       //Access parent window from popup

       if(window.top){

         var stockOwnerVal = window.top.rbf_getFieldValue('R601101'); //Use relationship name of Stockowner

         var consigneeVal = window.top.rbf_getFieldValue('R601112'); //Use relationship name of consignee

         //Will return array of stock owner

         if(stockOwnerVal && stockOwnerVal.length > 0){

            console.log(stockOwnerVal);

    //TODO , use this stockowner array value to apply lookup filter

         }

         //Will return array of consignee

         if(consigneeVal && consigneeVal.length > 0){

            console.log(consigneeVal);

    //TODO , use this consignee array value to apply lookup filter

         }

       }

     }

     </script>

    I created sample App to demonstrate how to get values from parent page to quick create page and attached same along with this thread for your reference. Please try out and let us know

    Sample Shipment_v2.xml

    Hope this helps,

    Vimal.

  • Hello Vimal,

    Thanks for your solution. Will try this and update soon.

    Janani