Redirect to newly created project with CRM Script - Gives me the wrong project

Hi there

 

I'm getting pretty annnoyed, i've made a crm script that is supposed to create a project, and redirect to it afterwards.

The project is created just fine, BUT the redirect does for some reason not respect the project_id i entered in the address bar.

 

After creating the project, i use setVariable to redirect back to superoffice:

setVariable("url", getProgramTicket().substitute('Service/scripts/ticket.fcgi?_sf=0','Sales/default.aspx?project.main.minimonth.baoplysninger?project_id=' + pEnt.GetProjectId().toString() + '&diaryowner_id=' + assSearch.getField(0) + '&person_id=' + getCgiVariable('person_id')));

But that just redirects to the last active project, and not the one created - i see the correct url with the correct project_id in the address bar during the redirect - but then SuperOffice just changes it into the id of the last project i've worked on upon load, and shows that project instead.

 

Why the heck isn't it loading the project i request??

I tried outputting the generated url and accessing it manually, which works just fine....

Should i do a meta redirect instead? something else?

Thanks in advance.

RE: Redirect to newly created project with CRM Script - Gives me the wrong project

Hello,

We hit the same issue recently, turns out that CS translates the second "?" in the url to an "&", which breaks the soprotocol link.

We solved this by changing "?" to the encoded version "%3F", example:

  	// %3F = ? but CS translates this to an & since technically you can only have one ? in the url to indicate the query string but for soprotocol you need two ?
    setVariable("url", getCRMBaseURL() + "default.aspx?project.main.activate%3Fproject_id=" + projectEntity.GetProjectId().toString());

 

Av: David Hollegien 16. sep 2019

RE: Redirect to newly created project with CRM Script - Gives me the wrong project

Hi David, thanks that worked :)

Av: Dennis Aagaard Mortensgaard 16. sep 2019