Skip to main content
Member
August 10, 2026
Question

Error getting time subcomponents

  • August 10, 2026
  • 2 replies
  • 39 views

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

 

2 replies

Advisor
August 11, 2026

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
August 11, 2026

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