Forum Discussion

JérémyRenard's avatar
JérémyRenard
New Contributor II
7 hours ago

Managing Group Company Exits in the User Workflow View

Hello everyone,

We have several companies that have been sold or dissolved.

To simplify users’ work, we would like to stop displaying workflows for these entities for periods when they no longer exist within our group.

I’m not sure if this is the recommended approach, so please feel free to share your best practices with me.

For my part, I have several ideas:

  • Revoke access to the workflowProfile of the relevant entities via the access permissions of the users responsible for importing the data.
  • Use a Business Rule to retrieve the name of the entity linked to the user’s workflow and, using its Entity ID, retrieve the date the company left the group, which is stored in Text6.

This way, I could either display no periods (meaning there would be no workflow), display all 12 periods, or display only the X months of the year the user was in the group.

I can retrieve the ID of the entity assigned to the workflow, but I can’t retrieve the data in Text6.

I get the error “Object reference not set to an instance of an object.”

If args.MemberListArgs.MemberListName.XFEqualsIgnoreCase("IsFormValidForEntity") Then
	'-- Usage: T#Root.CustomMemberList(BRName=JR_MemberList, MemberListName=IsFormValidForEntity, CVName=[RLS010 Local - Compte de résultat])
	'T#|WFTime|
	
	Dim WfGUID As guid = si.WorkflowClusterPk.ProfileKey 'obtient la clé de profil du workflow actuel de l'utilisateur
	
	Dim EntityList As List(Of WorkflowProfileEntityInfo) = BRApi.Workflow.Metadata.GetProfileEntities(si, WfGUID)
	Dim entityId As Integer
	
	For Each eInfo As WorkflowProfileEntityInfo In EntityList
		api.LogMessage("Workflow Entity:" & eInfo.EntityName)
		entityId = BRApi.Finance.Members.GetMemberId(si, DimType.Entity.Id, eInfo.EntityName)
		api.LogMessage("entityId :" & entityId)							
	Next
	
	Dim entityText6 As String = api.entity.Text(entityId,6).ToString	'<-- Error Object reference not set to an instance of an object.
	api.LogMessage("entityText6 :" & entityText6)

Do you have any advice on the best way to handle an entity’s departure from the group, while retaining or not retaining the ability to access its previous workflows?

Sincerely,

No RepliesBe the first to reply