Skip to main content
added 6 characters in body
Source Link
Gautam Sheth
  • 31.1k
  • 1
  • 37
  • 65

spfx has some utility classes to help. start by import { UrlQueryParameterCollection } from '@microsoft/sp-core-library';

import { UrlQueryParameterCollection } from '@microsoft/sp-core-library'; 

Then in your onRender:

 var queryParameters = new UrlQueryParameterCollection(window.location.href); if (this.properties.mode !== modes.NEW) { if (queryParameters.getValue("Id")) { const id: number = parseInt(queryParameters.getValue("Id")); let fields = "*,ParentTR/Title,Requestor/Title"; // get the requested tr pnp.sp.web.lists.getByTitle("Technical Requests").items.getById(id).expand("ParentTR,Requestor").select(fields).inBatch(batch).get() .then((item) => { 

I create a 'mode' property on the property pane to specify if the form is in new, edit or display mode. Throw an error if no id is specified in display or edit mode. this example uses pnp-js-core.

hth

spfx has some utility classes to help. start by import { UrlQueryParameterCollection } from '@microsoft/sp-core-library';

Then in your onRender:

 var queryParameters = new UrlQueryParameterCollection(window.location.href); if (this.properties.mode !== modes.NEW) { if (queryParameters.getValue("Id")) { const id: number = parseInt(queryParameters.getValue("Id")); let fields = "*,ParentTR/Title,Requestor/Title"; // get the requested tr pnp.sp.web.lists.getByTitle("Technical Requests").items.getById(id).expand("ParentTR,Requestor").select(fields).inBatch(batch).get() .then((item) => { 

I create a 'mode' property on the property pane to specify if the form is in new, edit or display mode. Throw an error if no id is specified in display or edit mode. this example uses pnp-js-core.

hth

spfx has some utility classes to help. start by

import { UrlQueryParameterCollection } from '@microsoft/sp-core-library'; 

Then in your onRender:

 var queryParameters = new UrlQueryParameterCollection(window.location.href); if (this.properties.mode !== modes.NEW) { if (queryParameters.getValue("Id")) { const id: number = parseInt(queryParameters.getValue("Id")); let fields = "*,ParentTR/Title,Requestor/Title"; // get the requested tr pnp.sp.web.lists.getByTitle("Technical Requests").items.getById(id).expand("ParentTR,Requestor").select(fields).inBatch(batch).get() .then((item) => { 

I create a 'mode' property on the property pane to specify if the form is in new, edit or display mode. Throw an error if no id is specified in display or edit mode. this example uses pnp-js-core.

hth

Source Link
RussGove
  • 1.3k
  • 1
  • 17
  • 24

spfx has some utility classes to help. start by import { UrlQueryParameterCollection } from '@microsoft/sp-core-library';

Then in your onRender:

 var queryParameters = new UrlQueryParameterCollection(window.location.href); if (this.properties.mode !== modes.NEW) { if (queryParameters.getValue("Id")) { const id: number = parseInt(queryParameters.getValue("Id")); let fields = "*,ParentTR/Title,Requestor/Title"; // get the requested tr pnp.sp.web.lists.getByTitle("Technical Requests").items.getById(id).expand("ParentTR,Requestor").select(fields).inBatch(batch).get() .then((item) => { 

I create a 'mode' property on the property pane to specify if the form is in new, edit or display mode. Throw an error if no id is specified in display or edit mode. this example uses pnp-js-core.

hth