Forum Discussion

umakant's avatar
umakant
New Contributor
5 years ago

Set value to Project variable of object type

I am trying to use Project variable of object type to store my object name mapping. But after I create the project variable of object type, I am not able to assign a value. I am getting an error "The variable of the object type cannot be edited"?

 

Please help me to fix this.

 

Thanks,

Umakant

5 Replies

  • Wamboo's avatar
    Wamboo
    Community Hero

    Hi

     

    You can't do this in project variables inside IDE, but you can easily add value in script routine.

     

      let obj = Project.Variables.Var1 = {param: "val", param2: "val2"};
    • umakant's avatar
      umakant
      New Contributor

      Wamboo Thanks for your response.

       

      Here is what I am trying to do

      1. I have a object reference (Aliases.browser.pageSvl005epicno301EcmcLan8443Ep2) in my script routine 

      2.  I would like to store it in Project Variable for Object type

      3. Like you mentioned 

      let obj = Project.Variables.Var1 = {param: "val", param2: "val2"};

      what does param: "val" referring to here. I am  not sure about it? Please help me understand it.

       

      Thanks,

      Umakant 

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Basically, object type variables can only be assigned in code.  So, you would have to do an assignment like

         

        Project.Variables.Var1 = Aliases.browser.pageSvl005epicno301EcmcLan8443Ep2

        You can't assign it ahead of time.