cancel
Showing results for 
Search instead for 
Did you mean: 

Error fetching information from BO Identity in offline mode

Former Member
0 Kudos

Hello,

I developed the script below where I search for the UUID of the logged in user, and I perform a Query in BO Identity with this field as a parameter, to identify the InternalID of that user.

The code is working correctly online, but in offline mode, the query option is not enabled in this BO. And when trying to use the Retrieve option, which is available, it is necessary to send the ID as a parameter, and we don't have that information.

Does anyone know if there is any other way to fetch the BO identity information using the UUID?

Thank you!

if(activity.GetFromDB().IsInitial()){
		var UUIDUsuario = Context.GetCurrentIdentityUUID().content; //UUID do usuário logado

		var queryByIdentityUUID = Identity.QueryByElements;
		var queryByIdentityUUIDParameter = queryByIdentityUUID.CreateSelectionParams();
		queryByIdentityUUIDParameter.Add( queryByIdentityUUID.UUID.content, "I", "EQ", UUIDUsuario.ToString());
		var result = queryByIdentityUUID.Execute(queryByIdentityUUIDParameter).GetFirst();

		var idEmpregado = result.Person.InternalID; //ID do empregado logado
		var idCliente = activity.MainActivityParty.PartyID.RemoveLeadingZeros(); //ID do cliente selecionado

		if(!idEmpregado.IsInitial() && !idCliente.IsInitial()){
			var retrieveCliente = Customer.Retrieve(idCliente).Relationship;

			if(retrieveCliente.Count() > 0){
				var relacaoClienteEmpregado = retrieveCliente.Where(n=> n.RelationshipBusinessPartnerInternalID == idEmpregado); //Relações entre Empregado e Cliente

				foreach(var relacoes in relacaoClienteEmpregado){
					var queryParametros = ZParametroSistemico.QueryByElements;
					var queryParametros_SelParams = queryParametros.CreateSelectionParams();
					queryParametros_SelParams.Add(queryParametros.Descricao, "I", "EQ", relacoes.RoleCode.content);
					queryParametros_SelParams.Add(queryParametros.TipoParametro, "I", "EQ", "7");
					var queryParametros_Results = queryParametros.Execute(queryParametros_SelParams);

					if(queryParametros_Results.Count() > 0){
						activity.ZAreaMKTIDXBO = queryParametros_Results.GetFirst().Texto;
					}
				}
			}
		}

		if(!activity.ZAreaMKTIDXBO.IsInitial()){
			var areaMKT = ZAreaMKT.Retrieve(activity.ZAreaMKTIDXBO);

			if(areaMKT.IsSet()){
				activity.ZAreaMKTIDXBO = areaMKT.Descricao; //Preenche a descrição da Área de MKT
			}else{
				raise MsgRoot.Create("W",activity.ZAreaMKTIDXBO,"ID não encontrado");
				activity.ZAreaMKTIDXBO.Clear();
				activity.ZAreaMKTIDXBO.Clear();
			}
		}
	}

Accepted Solutions (0)

Answers (0)