Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, June 21, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Sales Process - Scribe Question
Rekha
Posts: 72
 
Sales Process - Scribe QuestionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 01 Nov 07 5:22 PM
Hi, I have a set of opportunities from a legacy database that needs to go into Saleslogix. I have a requirement that whenever a new opportunity in entered into Saleslogix through Scribe (DTS tool). I have to associate all the steps that I had already created in SalesLogix. (Basically attach the Salesprocess through backend). Sometimes, the opportunities would be have way through in legacy (i mean it would be booked status). I have used steps like initial contact, qualifying, booked, etc... accordingly I will update opportunity table.

Things I need to do are:
1. Insert steps to new opportunity
2. update steps according to the stage completion.

I am having hard time with the XML. I have an idea of creating script in SQL that will parse the XML and insert the steps into table for opportunityid and update steps accordingly. Is there a better way of inserting steps to new opportunity and update them programmatically?

Any help much appreciated....

Thanks,
Rekha
[Reply][Quote]
Rekha
Posts: 72
 
Re: Sales Process - Scribe QuestionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 01 Nov 07 5:25 PM
I found this code to read XML and put it into a table. Problem is, SalesProcess XML is way too complicated to be used like this. Its killing me... Anyone who has better idea to implement this?


declare @idoc int
declare @doc varchar(1000)
set @doc ='








OrderDate="1996-08-16T00:00:00">



'
--Create an internal representation of the XML document.
exec sp_xml_preparedocument @idoc OUTPUT, @doc
-- SELECT stmt using OPENXML rowset provider
SELECT *
FROM OPENXML (@idoc, '/ROOT/Customer/Order/OrderDetail',2)
WITH
(
ContactName varchar(20) '../@ContactName',
OrderID int '../@OrderID',
CustomerID varchar(10) '../@CustomerID',
EmployeeID varchar(10) '../@EmployeeID',
OrderDate datetime '../@OrderDate',
ProdID int '@ProductID',
Qty int '@Quantity'
)

[Reply][Quote]
Ed Paxson
Posts: 37
 
Re: Sales Process - Scribe QuestionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Nov 07 8:31 AM
Rekha - I have the same problem but never received a response to my post. Mine is not quite as complicated, just a brand new sales process. Only thing I can't get to work is the XML. Please let me know if you find a solution. Where in Scribe to you fire off the script to try and write the xml for each record? Thanks.
[Reply][Quote]
Rekha
Posts: 72
 
Re: Sales Process - Scribe QuestionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Nov 07 11:03 AM
Hi Ed,

I found a novel solution for my royal pain. Save this as VBscript in desktop and run it for a new opporunity (mine is called Group Booking). This can be run as Agent to associate new opportunity. but backend steps need to be done thru scribe. just half way thru the process...

Dim slxApp
Set slxApp = CreateObject("SalesLogix.SlxApplication")
DIM currOppID
currOppID = slxApp.BasicFunctions.CurrentOpportunityId
msgbox currOppID

slxApp.BasicFunctions.GlobalInfoSet "SP_SalesProcess", "Group Booking"
slxApp.BasicFunctions.GlobalInfoSet "SP_EntityID", currOppID
slxApp.BasicFunctions.DoInvoke "ActiveScript", "System:SP_InitSalesProcess"
slxApp.BasicFunctions.GlobalInfoClear "SP_SalesProcess"
slxApp.BasicFunctions.GlobalInfoClear "SP_EntityID"



[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Sales Process - Scribe QuestionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Nov 07 12:43 PM
Be aware that the code you posted will only work with a running SLX client open, so might not be a good idea if you expect to run as agent.
[Reply][Quote]
Rekha
Posts: 72
 
Re: Sales Process - Scribe QuestionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Nov 07 7:58 PM
Hi Ryan, Thanks for the tip.

Found another solution

Declare @RawXML as nvarchar(max)
Declare @XMLString as nvarchar(max)
/*
--
SET @RawXML =
'


T


1

1
30


1


T
0
0

<scriptAction>



ActiveScript





</scriptAction>



2

3
30


1


T
0
0

<scriptAction>



ActiveScript





</scriptAction>



3

5
7


1


T
0
0

<scriptAction>



ActiveScript





</scriptAction>

2


T
0
0

<scriptAction>



ActiveScript





</scriptAction>



4

9
14


1


T
0
0
""



5

41
7


1


T
0
0
""



6

64
7


1


T
0
0
""



7

97
7


1


T
0
0
""



8

100
7


1


T
0
0
""





'
*/
SELECT @RawXML = SalesProcessXML FROM C_SALESPROCESS_XML WHERE SalesProcessName = 'Group Booking'
SELECT @XMLString = Replace(@RawXML, '""', '"')
SELECT @XMLString = Substring(@XMLString, CHARINDEX( '', @XMLString), LEN(@XMLString))

--insert into c_salesprocess_xml (c_salesprocess_xmlid,salesprocessname, salesprocessxml)
DECLARE @IDoc as int
-- initialize the xml handle for using the XML string text

EXEC sp_xml_preparedocument @IDoc OUTPUT, @XMLString

-- SalesProcess
SELECT SalesProcessName
FROM
OPENXML(@IDoc, 'SalesProcess')
WITH
(
SalesProcessName nvarchar(100) './Name'
)

-- Stages
SELECT *
FROM
OPENXML(@IDoc, 'SalesProcess/Stages/Stage')
WITH
(
StageID nvarchar(100) './@ID'
, NextID nvarchar(100) './@NextID'
, OrderNumber nvarchar(10) './OrderNumber'
, Name nvarchar(100) './Name'
, Probability int './Probability'
, EstDays int './EstDays'
)
-- Steps
SELECT *
FROM
OPENXML(@IDoc, 'SalesProcess/Stages/Stage/Steps/Step')
WITH
(
StageID nvarchar(100) '../../@ID'
, StepID nvarchar(100) './@ID'
, NextID nvarchar(100) './@NextID'
, OrderNumber nvarchar(10) './OrderNumber'
, Name nvarchar(100) './Name'
, Required nvarchar(1) './Required'
, Description nvarchar(100) './Description'
, Probability int '../../Probability'
, EstDays int '../../EstDays'
)


-- remove the handle from memory
EXEC sp_xml_removedocument @IDoc

[Reply][Quote]
Rekha
Posts: 72
 
Re: Sales Process - Scribe QuestionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Nov 07 7:59 PM
Was not able to post the XML correctly...
[Reply][Quote]
Rekha
Posts: 72
 
Re: Sales Process - Scribe QuestionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Nov 07 8:01 PM
Hi Ed, Just found another solution. check my previous post ...
[Reply][Quote]
Ed Paxson
Posts: 37
 
Re: Sales Process - Scribe QuestionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Nov 07 8:39 AM
Hi Rekha - You got the one starting with 'Declare @RawXML as nvarchar(max)' to work? Ed.
[Reply][Quote]
Rekha
Posts: 72
 
Re: Sales Process - Scribe QuestionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Nov 07 9:27 AM
Hi Ed,

Since I dont know what you are trying to achieve, I will just describe how my scenario works...

The XML part will only get flat values that need to be entered during a new opportunityid for salesprocess.

You may have to identify which records dont have salesprocess and based on it, create or update existing salesprocess like below.

Insert into #TempTable(Opportunityid, Status)
SELECT O.Opportunityid, O.Status from Opportunity O Inner Join C_Opportunity_Ext OE ON
O.Opportunityid = OE.Opportunityid Where O.Opportunityid not in
(Select SP.EntityId from SalesProcesses SP where SP.EntityId is Not null)
and O.OpportunityId is not null

Later loop through each record and complete whichever step you want to complete.

UPDATE SALESPROCESSAUDIT SET COMPLETED = 'T', ISCURRENT = 'T' Where Entityid = @Opportunityid and SEQ <= @Seq

your @Seq will be from 0 - n based on steps and there will be a header and footer which needs to be checked too...

Rest of the items need to be done in scribe. such as creating primary key for opportunityid, SALESPROCESSES, SALESPROCESSAUDIT for adding steps, first get an opportunityid, then get primarykey for SALESPROCESSES, then create primary key for SALESPROCESSAUDIT. (Entityid in SALESPROCESSES, SALESPROCESSAUDIT is your opportunityid)

Hope it makes sense.... If not do let me know.. I am yet to complete this... will let you know after fully completing it...

Regards,
Rekha
[Reply][Quote]
Ed Paxson
Posts: 37
 
Re: Sales Process - Scribe QuestionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Nov 07 9:50 AM
Rekha - Thanks for the response. I have the scribe job creating the opportunities and the associated sales process with the salesprocessaudit records. Don't need any of the steps completed. Just need to somehow write the xml to the data field in the salepsrocessaudit record.
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 6/21/2025 3:13:51 AM