Coming soon: Your brand new Help Center & Community! Get a sneak-peek here

Trying to fetch SaleStage for SuperOffice Online

Hi,

We are currently building a solution that heavly rely on getting Sale data and where SaleStage is a main cornerstone.

How can we get hold of a sales SaleStage in Online?

The standard way

Since both Sale and SaleEntity does not have anything to do with SaleStage, only the SaleStages Probability % that we really cant use

Using FindAgent

Have the FindAgent been disabled? Im running the following code:

          using (var findAgent = new FindAgent())
                {
                    string providerName = "dynamic";

                    var restrictions = new SuperOffice.Services75.ArchiveRestrictionInfo[]
                    {
      new SuperOffice.Services75.ArchiveRestrictionInfo()
      {
          Name = "sale.associate_id",
          Operator = "equals",
          Values = new string[]{"5"}
      }
                    };

                    var allUserGroupNames = findAgent.FindFromRestrictionsColumns(
                        restrictions,
                        providerName,
                        new[] { "sale.associate_id" },
                        int.MaxValue,
                        0);}

But it always returns 0, even if i modify the restrictions so it would always return a result, it never returns anything (this is intressting since we would like to add filters to the frontend)

Using saleAgent

I was hoping that it would at least be possible to use the saleagent and get hold of it, but the only thing regarding SaleStage i could find is: GetProbabilityFromStage

Using Rows

Not avalible in Online

So, how could i get hold of a sales Stage name and ID?

Regards
Pär Pettersson

RE: Trying to fetch SaleStage for SuperOffice Online

look into the embedded objects of the SaleAgent e.g. GetSaleEntity and GetSale
I believe you want the probabilityIdx..

/conrad

Af: Conrad Weyns 10. aug 2017

RE: Trying to fetch SaleStage for SuperOffice Online

Hi Pär,

You want to get the SaleStage of a particular sale? Well this is the result of two fields:

  1. Sale.SaleTypeId
  2. Sale.ProbabilityIdx

Because the possibilities of these are variable, you will need to know the correct listitem id's to know to change from one stage to another. 

In regards, to the FindAgent, it works just fine. I suspect your issue has to deal with using the versioned namespace not mapped to the endpoint version, which I repeatedly have said not to do. If using SuperOffice assemblies, only use types in SuperOffice.CRM.Services.

Hope this helps.

Af: Tony Yates 10. aug 2017

RE: Trying to fetch SaleStage for SuperOffice Online

Hi,

Thanks, but..where does one find ProbabilityIdx?

Sale:

SaleEntity:

 

Update: Using the following Nuget Packages

Af: Pär Pettersson 10. aug 2017

RE: Trying to fetch SaleStage for SuperOffice Online

Regarding FindAgent, you are correct, i had a bit of a messaged up namespace in that controller, that worked fine! Thank you!

But the question regarding ProbabilityIdx still remains

Kind regards
Pär Pettersson

Af: Pär Pettersson 10. aug 2017

RE: Trying to fetch SaleStage for SuperOffice Online

In this context,Probablility should be same as ProbabilityIdx (Edit: Wrong, use Rating). Additionally, use the MDOAgent to get the list of SaleStages and verify the Probability value is equal to the list id.

var saleTypeId = 1;

MDOListItem[] simpleList;

using (MDOAgent MDOAgent = new MDOAgent())
    simpleList = MDOAgent.GetList("SaleStage",
        true,
        string.Format("{0}={1}&{2}={3}&{4}={5}",
        "SaleTypeID", saleTypeId,
        "GetDeletedStageLinks", bool.FalseString,
        "GetDeletedStages", bool.FalseString
        ),
        false);

Hope this helps!

Af: Tony Yates 10. aug 2017

RE: Trying to fetch SaleStage for SuperOffice Online

Hi,

On the SaleEntity in the services layer you need to use "Rating" for the propability idx.

Af: David Hollegien 10. aug 2017

RE: Trying to fetch SaleStage for SuperOffice Online

David, you are a hero!

I will take a look at this in a moment.

FYI Tony:
Its not, its the % as i wrote in the first entry

All SaleStages

Sale


SaleEntity

 

Will give Rating a tryout now, thanks!

Af: Pär Pettersson 10. aug 2017

RE: Trying to fetch SaleStage for SuperOffice Online

Raiting on SaleEntity was the name of the game!

Thanks alot!

Regards
Pär

Af: Pär Pettersson 10. aug 2017