Displaying a custom object entry by its ID as a URL parameter?

lock
push_pin
done
Besvaret
6

Hi,

I had a chat with a customer yesterday, and the need to open a custom object entry by using its table name + ID in the URL arose. I noticed there are no custom object parameters in the URL when viewing the current custom object dialog.

However, according to the SoProtocol section in the docs, we should be able to open a custom object by using:

default.aspx?customobject?customobject_name=y_car&customobject_id=1520

I can't get this to work though. Is this supposed to work in the current version? Or is it maybe intended for a future update where the screen designer for custom objects is released?

Espen

13. sep. 2024 | 07.28 AM

Alle Svar (6)

Hi Espen,

Not sure in what context you are trying this, but from version 10.3.8 we do support these soprotocols triggered from buttons or links added in screen designer. 

 

13. sep. 2024 | 08.12 AM

Hello Espen, 

I'm not sure which version or tenant you are working on, but this works on my SOD-tenant:

PageUpdate("soprotocol:customobject?customobject_name=y_car&customobject_id=1"); 

You can run this in developer console, in your browser:
1. Log in to SuperOffice
2. Open developer tools (F12)
3. Go to the console and run the command above. 

Let me know if this works for you, or get back to me with which tenant you are working on so i can take a closer look

//Eivind

13. sep. 2024 | 08.36 AM

Thanks for the quick replies. I've tested in 10.3.9.

Using the PageUpdate function in the browser console does work. What I was trying to achieve though, is to open the custom object by entering the URL in the browser.

This does not work:

https://online.superoffice.com/CustXXXXX/default.aspx?customobject?customobject_name=y_tablename&customobject_id=1
13. sep. 2024 | 10.13 AM

Hi again, 

It looks like its unable to resolve that, so unfortunately this is not implemented. E.g. it does not work to input the URI directly in the browser.

Using soprotol does work, though, even if used through 'normal' webpanels and custom screens.

I'm not sure about the usercase, but as a workaround you could also create a short crmscript that shows a dialog, and from that use the soprotocol to open that id.. Example:

#setLanguageLevel 4;

EventData ed = getEventData();
String step1 = ed.getInputValue("custom_button");

if(step1 == "")
{
    Integer default;
    EventDataDialogDefinition dialog;
    dialog.setTitle("Open Custom Objects");
    dialog.setType("okcancel");
    dialog.setIcon("info");
    dialog.setPrefix("custom_");
    dialog.setText("Input rowId you want to open:");
    dialog.addInteger("id", "RowId", default, "", true);
    ed.showDialog(dialog);
    ed.setOutputValue("custom_button", "yes");
}
else {
    ed.setNavigateTo("soprotocol:customobject?customobject_name=y_car&customobject_id=" + ed.getInputValue("custom_id"));
}

Feel free to register this as a wish as well! :)

//Eivind

13. sep. 2024 | 11.05 AM

Thank you, Eivind. The URL will be clicked in an external system, so an EventData button won't help me in this case. I can't think of any straightforward non-hacky way to do this until it works directly via the URL at some point, but any ideas are welcome.

20. sep. 2024 | 08.22 AM

For anyone who might have the same issue, I came up with this solution as a workaround.

  1. Make a CRMScript that saves the custom object ID as a session variable using "setSessionVariable()" and immediately redirects the user to a browser panel (on the SuperOffice button).

    Call it by using "/blogic.fcgi?_sf=0&action=doScript&id=xxx?customObjectId=1".
    (a good idea would to have a separate parameter for the custom object  name so it can be used for any custom object, but i didn't do that here).
    #setLanguageLevel 4;
    
    // Save object ID that we want to open
    String customObjectId = getCgiVariable("customObjectId");
    setSessionVariable("openCustomObjectId", customObjectId);
    
    // Then redirect to web panel that shows a CS Screen that will pick up the session variable:
    setVariable("url", "https://online.superoffice.com/CustXXXXX/default.aspx?browser.displaycustomobject");

     

  2. Make a CS Screen that picks up the session variable we just stored, and use ClientCrossMessaging to display to the custom object.
    Display the screen as a browser web panel.


    In this way, the user has clicked a link -> CRMScript redirects them to a blank web panel -> The custom object dialog opens outside the web panel.

 

Edit: I originally tried to include some more code examples, but the code blocks really didn't like the HTML sections, so I removed it.

20. sep. 2024 | 11.40 AM

Tilføj svar