When I display a list form (modern UI), I want to get the list view ID and item ID and register them in the database.

What method can I use to achieve this?

Please share advise here.

  • Where and how are you displaying a list form? Sep 21, 2022 at 5:38
  • The list form that appears when an item in the list view is clicked. This is the default list form that appears on the right side of the screen.
    – yuki
    Sep 21, 2022 at 6:06
  • From list view page, you can get view ID using: _spPageContextInfo.viewId Sep 21, 2022 at 6:21
  • I was able to get a view ID using the method you taught me. Thank you!!!!! How can I get the item ID of the item being displayed?
    – yuki
    Sep 21, 2022 at 8:02
  • Are you using SPFx application customizer on list view page or any other customization way? I will check for ways to get item ID accordingly. Sep 21, 2022 at 8:15

1 Answer 1


To get list view ID:

From list view page, you can get view ID using: _spPageContextInfo.viewId

To get list item ID:

Try below to get list item ID from SPFx Field Customizer:

const id = event.listItem.getValueByName('ID');

Source: SentimentAnalyticsFieldCustomizer


let itemId=event.listItem["_values"].get("ID")

Source: SPFX Field Customizer: how to get Id of item in list?

  • I apologize, I did not make myself clear.I want to get ID of the item being displayed in the form list. Perhaps if I can get the ID of the currently selected item in the list view, I can achieve my goal.
    – yuki
    Sep 21, 2022 at 9:48
  • You can get the currently selected item ID on list form using power apps to customize the list form. Sep 21, 2022 at 11:29
  • Thank you very much!! Resolved.
    – yuki
    Sep 22, 2022 at 5:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.