Hello,
We are experiencing issues with a portal using a!queryRecordType. On the home page of the portal we have richTextDisplay that is fed from a queryRecordType. The first time entering the portal it gives an error (ss attached) saying the input is null. Refreshing the page allows the portal to load and everything loads correctly. I think its an issue with queryRecordType not loading quick enough to be used as text on the portal. Has anyone been able to use a!queryRecordType on the home page of their portals without issue? Or is there a better way to reference data on the home page to avoid the error? Thank you.This is the code for our query:
local!reports: a!refreshVariable( value: a!queryRecordType_25r3( recordType: 'recordType!{81df50d7-662a-4e27-9236-7c155c79c0b5}OW Report', fields: { 'recordType!{81df50d7-662a-4e27-9236-7c155c79c0b5}OW Report.fields.{7764c501-7bc3-4d78-bac3-922803158f04}reporttypeId', 'recordType!{81df50d7-662a-4e27-9236-7c155c79c0b5}OW Report.fields.{075bbb3b-097b-4886-9e4f-2031db58b527}id', 'recordType!{81df50d7-662a-4e27-9236-7c155c79c0b5}OW Report.fields.{10976e33-4cf5-4af8-b8b0-9c33f57369ea}location', 'recordType!{81df50d7-662a-4e27-9236-7c155c79c0b5}OW Report.fields.{73dfdd9f-46ff-4507-945e-8ee4711f83dc}reportNumber', 'recordType!{81df50d7-662a-4e27-9236-7c155c79c0b5}OW Report.relationships.{b5856472-4f10-44cc-8133-36dd3ca41e74}documents.fields.{97c879c5-64e6-45d0-ad1f-7a782e0941c2}name', 'recordType!{81df50d7-662a-4e27-9236-7c155c79c0b5}OW Report.relationships.{b5856472-4f10-44cc-8133-36dd3ca41e74}documents.fields.{3ffe510a-aa2a-4511-b087-c34189e1d805}publishDate' }, pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 4, sort: a!sortInfo( field: 'recordType!{81df50d7-662a-4e27-9236-7c155c79c0b5}OW Report.relationships.{b5856472-4f10-44cc-8133-36dd3ca41e74}documents.fields.{3ffe510a-aa2a-4511-b087-c34189e1d805}publishDate', ascending: false() ) ), fetchTotalCount: true() ), refreshAlways: true() ),
a!richTextDisplayField( labelPosition: "COLLAPSED", value: { if( a!isNotNullOrEmpty(local!recentReports[1]['recordType!{81df50d7-662a-4e27-9236-7c155c79c0b5}OW Report.relationships.{b5856472-4f10-44cc-8133-36dd3ca41e74}documents.fields.{3ffe510a-aa2a-4511-b087-c34189e1d805}publishDate']), text( local!recentReports[1]['recordType!{81df50d7-662a-4e27-9236-7c155c79c0b5}OW Report.relationships.{b5856472-4f10-44cc-8133-36dd3ca41e74}documents.fields.{3ffe510a-aa2a-4511-b087-c34189e1d805}publishDate'], "MMMM dd, yyyy" ), "" ),
Discussion posts and replies are publicly visible
The query isn’t returning data fast enough on initial portal load, causing the rich text field to reference null values.
Add null-handling checks before accessing nested data. The code already has a!isNotNullOrEmpty() check but needs to verify local!recentReports itself isn’t empty before accessing [1].