Skip to main content
Member
Aug 10, 2026 9:31 PM UTC
Solved

Error getting time subcomponents

I am getting the error “Object reference not set to an instance of an object.” with the code below in a connector business rule.  I feel like I’ve used this code a ton but never had this issue before.  Anyone have any thoughts on what I might be doing wrong this time?

WorkflowUnitPk wfPk = api.WorkflowUnitPk;
string wfTime = TimeDimHelper.GetNameFromId(wfPk.TimeKey);
TimeMemberSubComponents objTimeCmpnts = BRApi.Finance.Time.GetSubComponentsFromName(si, wfTime);
int wfFiscalYr = objTimeCmpnts.Year;
int wfFiscalPer = objTimeCmpnts.Month;

Thanks,
Scott

 

sameburnAnswer
Employee - Advisor
Aug 11, 2026 7:06 AM UTC

Hi ​@ssmith-nova 

I don’t think there is anything wrong with your Code e.g. see below 

 

So potentially your wfTime variable derived from Transformer api (I am assuming this is in a Connector) is returning a Year only in which case wfFiscalPer would be zero instead of an actual period… or somewhere else in your code e.g. maybe after referenced section?

 

Have you tried logging wfTime and commenting out everything underneath (in your example)?  That should help demystify whether this is the section of code causing the unresolved object error

Hope this helps

Sam

2 replies

sameburnEmployee - AdvisorAnswer
Employee - Advisor
Aug 11, 2026 7:06 AM UTC

Hi ​@ssmith-nova 

I don’t think there is anything wrong with your Code e.g. see below 

 

So potentially your wfTime variable derived from Transformer api (I am assuming this is in a Connector) is returning a Year only in which case wfFiscalPer would be zero instead of an actual period… or somewhere else in your code e.g. maybe after referenced section?

 

Have you tried logging wfTime and commenting out everything underneath (in your example)?  That should help demystify whether this is the section of code causing the unresolved object error

Hope this helps

Sam

Member
Aug 11, 2026 6:00 PM UTC

I found my problem, I was trying to set si as a global variable and I had the assignment backwards.  I did si = this.si  instead of this.si = si.  After I changed that everything magically started working correctly.

 

Thanks for the response.

Scott