Webpanel URL to sales selection?

Hi,

 

I would like to create a Webpanel on the request that shows all Sales with TicketId in name.

Is there a URL that you can use to load a Selection in Sales with TicketID as criteria. This url should not include menu etc of sales.

 

Regards,

Johan

 

 

 

RE: Webpanel URL to sales selection?

It would be good to know at what stage of task you right now, for example have you conected Sales with Requests already? 

If not, I am suggesting to take a look at this FAQ where in the first part it says how to link Requests and Sales 

https://online2.superoffice.com/Cust1990/CS/scripts/customer.fcgi?_sf=0&custSessionKey=&customerLang=en&noCookies=true&action=viewKbEntry&id=113564

Later on you could use newly created field in details under the ticket to see to what sale request is linked to.   

 

Von: Donatas Sasnauskas 12. Jan 2021

RE: Webpanel URL to sales selection?

Hi,

 

I have read this and this only connects a request to a Sale/Project and list them under the Sale/Project in SuperOffice CRM.

 

I would like to have a Webpanel that lists all Sales that have name containing request number. Sales are syncroninzed from our ERP and we use request number as reference when it is related to a request and this then become the Name of sale

 

Von: Johan Friberg 12. Jan 2021

RE: Webpanel URL to sales selection?

Hi Johan,

I think what you want to display is a pane in the "View Ticket" screen that shows all Sales with a heading that contains the ticket id, am I correct?

It's not a very sexy solution, but it's something that you can do which requires almost no time. However, if you want a better solution with more functionality , scripting is the way here.

First, you click the burger menu in the top right corner and click "System design" and "Web panels".

On the "View request", you click the "New web panel" text that appears while hovering over the menu.

  • Label: Sales (or whatever you want the web panel to be called)
  • Check: Use Url:
    • Base Program: Ticket
    • Url (copy and paste this): &action=searchTable&_hideFramework=1&ok=1&table=sale&field.0=sale.heading&operator.0=7&value.0=
  • Append ID: Check this
  • Position: Set to a higher number than 1 so that it doesn't appear before the Messages and Details panels
  • Click Ok

You should get something like this:

 

Von: Simen Mostuen Iversen 12. Jan 2021

RE: Webpanel URL to sales selection?

Hi Simen,

 

You understood me currectly and your solution did what I wanted. Of course a script is a better way of doing it, I started with the following that gives me the proper data.

What would be the best way of formating this?

 

#setLanguageLevel 3;

String myTicket = getCgiVariable("entryId");
String msg="";

SearchEngine se;
se.addField("sale.sale_id");
se.addField("sale.heading");
se.addField("sale.saledate");
se.addField("sale.number1");
se.addCriteria("sale.heading", "Equals", myTicket);
for (se.execute(); !se.eof(); se.next()){
msg+= se.getField(0) + "; " + se.getField(1) + "; " + se.getField(2) +"; " + se.getField(3) + "\r\n";
}
print(msg); /* print all results */

 

Von: Johan Friberg 12. Jan 2021

RE: Webpanel URL to sales selection?

So this is strange, when I started to work again, 2-3h later this give me no results. What can be the issue with my script since it did work erlier?

Von: Johan Friberg 12. Jan 2021

RE: Webpanel URL to sales selection?

Why it suddenly stopped working is difficult for me to say without looking at the solution.

Just one tip, I advise you to use string.append(new string); instead of += as it's much better for optimalization if there's lots of text.

Also, are you sure that you mean "Equals" and not "BeginsWith" or "Contains"? This means that the Sales Heading needs the be identical to the Ticket ID.

Example:

#setLanguageLevel 3;

String myTicket = getCgiVariable("entryId");
String msg;

if(myTicket.toInteger() > 0)
{
  SearchEngine se;
  se.addField("sale.sale_id");
  se.addField("sale.heading");
  se.addField("sale.saledate");
  se.addField("sale.number1");
  se.addCriteria("sale.heading", "Equals", myTicket);
  for (se.execute(); !se.eof(); se.next()){
    msg.append(se.getField(0) + "; " + se.getField(1) + "; " + se.getField(2) +"; " + se.getField(3) + "\r\n");
  }
}
print(msg); /* print all results */
Von: Simen Mostuen Iversen 13. Jan 2021