1. Script for creating URL with parameters

    Article: AN0001905Updated:

    It is possible to pass the values between pages by means of URL parameters. URL can contain more parameters that are separated by character &.

    Example of URL request with two parameters:

    https://www.objectgears.eu/DataDetail.aspx?Id=429-0&incId=1364&returnUrl=DataDetail.aspx%3fId%3d430-1364

    In order to create parameters in URL we have to compose corresponding string. Following example is used to open a new record in the class problem, to pass record Id of the incident, from which the problem is created and and include parameter returnURL. We will process the Id passed by a parameter in the class problem by means of a script (filling in fields with values from the incident). After saving the new record of problem, the corresponding incident record is opened because there was parameter returnUrl in the URL string.

    Where to use this script: Button of type Script

    //Saves the record, if it is not saved. It creates URL request for creating a new record in the class 'problem' and passes parameter incId, that contains record Id of the incident, from which the problem is created, and parameter returnUrl pointing at incident detail, from which the incident is created.

    if ( OGDataDetailForm.Save(false))
    {
        var clProb = OG.ClassDef.GetByCode( OGModel.Id, 'problem');
        var newProblem = 'DataDetail.aspx?Id=' + clProb.Id + '-0&incId=' + OGActualDataRowId;
        var ret = 'returnUrl=DataDetail.aspx%3fId%3d' + OGActualDataRowParentId + '-' + OGActualDataRowId;
        OGForm.RedirectTo(newProblem + '&' + ret);
    }

×