Using the SubmitRequest Web Method
6 min
creates and submits a service request on behalf of a specified user request syntax public frsheatsubmitrequestresponse submitrequest(string sessionkey, string tenantid, string subscriptionid, list\<frsheatservicereqparam> srparameters, string loginid) parameters sessionkey the session key from the connect web method tenantid the tenant for which the session key is authenticated subscriptionid the subscription id corresponding to the request offering for the current user srparameters a list of frsheatservicereqparam objects that represent the key values for the parameters for submitting the service request loginid the login id of the user the frsheatservicereqparam class is defined as follows public class frsheatservicereqparam { public string strname; public string strvalue; } the frsheatservicereqparam class has the following fields strname name of the parameter strvalue value for the parameter return value frsheatsubmitrequestresponse object, defined as follows public class frsheatsubmitrequestresponse { public string status { get; set; } public string exceptionreason { get; set; } public frsheatservicereqrequest reqdata { get; set; } } the frsheatsubmitrequestresponse class has the following fields status provides a status about the state of the connection the table below contains a full description of the available status values exceptionreason contains exception information, if the application throws an exception when running this web method reqdata contains an frsheatservicereqrequest object, containing the service request that is successfully submitted the frsheatservicereqrequest class is defined as follows public class frsheatservicereqrequest { public string strrequestrecid; public string strrequestnum; public decimal ftotalprice; public decimal ftotalrecurprice; public string strbyemployee; public string strfulfillmentplantype; public string strurgency; public datetime? datesubmitted; public datetime? dateupdated; public string strupdatedby; public datetime? datedelivery; public string strsubscriptionrecid; public bool isfulfilled; public string strname; public string strdescription; public decimal fprice; public decimal frecurprice; public int nrecurperiod; public int ndeliverycommitment; public string strstatus; public string strcreatedby; public string strrecid; public list\<frsheatservicereqtemplateparam> lstparameters; } the frsheatservicereqrequest class has the following fields datedelivery delivery date for the service request strsubscriptionrecid recid of the subscription corresponding to the service request isfulfilled flag indicating whether the service request has been fulfilled or not strname name of the request offering from which the service request was created strdescription description of the service request fprice price of the service request frecurprice recurring price of the service request nrecurperiod recurrence period for the service request ndeliverycommitment delivery commitment period for the service request strstatus status of the service request strcreatedby login id of the user who created the service request strrecid recid of the service request lstparameters list of frsheatservicereqtemplateparam objects, where each item in the list represents the parameter value for the service request strrequestrecid recid of the service request strrequestnum id of the service request ftotalprice total non recurring price of the service request ftotalrecurprice total recurring price of the service request strbyemployee login id of the user who requested the service request strfulfillmentplantype type of fulfillment strurgency urgency value of the service request datesubmitted date when the service request was submitted dateupdated date when the service request was last updated strupdatedby login id of the user who last updated the service request the following table lists the available status values and describes how to interpret them \<font color="#ffffff">status\</font>\<font color="#ffffff">explanation\</font> success successfully retrieved the list of request offerings in the service catalog this list is available in the srtlist field usernotfound the tenant does not contain a user record with the specified login id ensure that the login id is spelled correctly reqparamsnotfilled one or more required parameters are not filled out check the exceptionreason field to determine which parameters were not filled out properly validationvaluesmismatch the value that was passed in for a drop down selection parameter does not belong in the validation list for example, the web method returns this status if there is a drop down selection parameter that is validated against the departments validation list and a value of "billing" is supplied to the submitrequest web method, but "billing" does not exist in the validation list check the exceptionreason field to determine which parameters were not filled out properly parametertypemismatch one or more parameters were specified with values, which are inappropriate for the underlying parameter data type for example, the web method returns this status if there is a parameter that is a text field and the input is a number (non text field) check the exceptionreason field to determine which parameters were specified incorrectly error an error was encountered during the execution of this web method inspect the corresponding exceptionreason field to determine why the web method has failed about service request submission validation before submitting the service request, the submitrequest web method performs three types of validation required parameters ensures that all parameters marked as required are filled out currently, the code handles unconditional required parameters and simple conditional required parameters if one or more required parameters are not filled out properly, the submitrequest web method returns a status of reqparamsnotfilled check the exceptionreason field to determine which parameters were not filled out properly validation values ensures that the supplied values are allowable values, based on the existing records in the validation list table currently, the code handles regular validation (that is, validation against a single field) and simple constrained validation (that is, validation that is constrained based on the value of an earlier field) if there are one or more parameters that do not satisfy the validation, the submitrequest web method returns a status of validationvaluesmismatch check the exceptionreason field to determine which parameters were not filled out properly parameter type checking ensures that the supplied value is appropriate for the data type of the specified parameter if there are one or more values that do not match the corresponding parameter type, the submitrequest web method returns a status of parametertypemismatch check the exceptionreason field to determine which parameters were specified incorrectly type checking of parameters in the service request prior to submitting the service request, the submitrequest web method checks the data type of the values, against the data types of the respective parameters the following table summarizes the various parameter types if data type validation is performed, the details section will describe this information in greater detail data type details text currently not validated this matches the current service catalog behavior checkbox allowed values are those that can be parsed as either true or false uses the boolean tryparse() method in microsoft net to determine if the value for checkbox is valid date / time / datetime allowed values are those that can be parsed as datetime values uses the datetime tryparse() method in microsoft net to determine if the value for the date, time, or datetime is valid to specify datetime values, specify the string value using iso 8601 format the value must be relative to utc the datetime value can be specified in one of the following two ways yyyy mm dd hh\ mm yyyy mm ddthh\ mm use either a space character or "t" character to separate the date and time values the following are two examples of specifying a datetime value of march 26th, 2013, 18 38 utc, using the above two formats 2013 03 26 18 38 2013 03 26t18 38 number / money allowed values are those that can be parsed as decimal values uses the decimal tryparse() method in microsoft net to determine if the numerical value is valid phone allowed values are phone numbers that match a us phone number such as (415) 555 1212 this matches the current service catalog behavior do not use this parameter type for validating international phone numbers ssn allowed values are numbers that match the us social security number format such as 123 45 6789 email currently not validated this matches the current service catalog behavior url currently not validated this matches the current service catalog behavior example string strsubscrrecid = frsvc getsubscriptionid(authsessionkey, tenantid, "domain password reset") subscriptionid; list\<frsheatservicereqparam> srparamlistitems = newlist\<frsheatservicereqparam>(); srparamlistitems add(newfrsheatservicereqparam { strname = "requesterdepartment", strvalue = "it" }); srparamlistitems add(newfrsheatservicereqparam { strname = "requester", strvalue = "ashley simon" }); frsheatsubmitrequestresponse srresponse = frsvc submitrequest(authsessionkey, tenantid, strsubscrrecid, srparamlistitems toarray(), loginid); frsheatservicereqrequest srres; if (srresponse status == "success") { srres = srresponse reqdata; } else { if (srresponse exceptionreason != null) { console writeline("error " + srresponse exceptionreason); } }
