[SOLVED] Can't create new menu with parameters

Version: 9.10.023 (27)
I have a dynamic new menu, but when I try to add parameters an error 500 occurs:
Without parameters work:
sc_appmenu_add_item(“menu_ppal”,$id_item,$id_parent,$rsm->fields[3],$rsm->fields[5], “”, $rsm->fields[7],"","_self");

If the parameters are hardcoded, It also works:
sc_appmenu_add_item(“menu_ppal”,$id_item,$id_parent,$rsm->fields[3],$rsm->fields[5], “param=1”, $rsm->fields[7],"","_self");

But, if the parameter is stored in a variable then doesn’t work, an 500 internal error occurs:
$param = “param=1”;
sc_appmenu_add_item(“menu_ppal”,$id_item,$id_parent,$rsm->fields[3],$rsm->fields[5], $param, $rsm->fields[7],"","_self");

any ideas or suggestions?
Thanks in advance!

Hi
try to assign fields of your query to variables and use them instead
$v1=$rsm->fields[3];

and verify before than they don’t are null
if (isset($rsm->fields[3])){
$v1=$rsm->fields[3];
}
else {
$v1=0 //or whatever
}

regards.

Hi aamertinez thaks for your reply, but the problem is specifically with the parameter ‘parameters’:
sc_appmenu_add_item(“Menu_Name”, “Id_Item”, “Id_Parent”, “Label”, “Aplication”, “Parameters”, “Icon”, “Hint”, “Target”),

In my data I don’t have any empty or null parameters, the problem only arises when trying to use the parameter ‘Parameters

regards.

Dear @Gustavo_Galvis,

The “parm” parameter does not accept a variable, only a string, which is why it gives the error you are facing. In practice, the error that occurs is syntax, because the “parm=” parameter and then the value are expected, and in this case when we assign it to a variable, it is as if it were one thing.

You can take a look at the source code that is generated from the menu application, which exactly in this part of the “parm” parameter, the construction is a little different from the other parameters.

We hope this point has been clarified.

Best regards!

Hi
in my case I use a global variable to pass the value to the application

it works.

regards.