Question

Sage CRM Introducing a custom table to a workflow

Asked by: TartanTaurus

Hi,

This one has long been a stumbling block for me so I thought I'd ask in here!

I have the standard Opportunity table with an opportunity workflow attached. All works great until I need to introduce a rule that forces the user to update an existing record in a custom table which is related to the Opportunity table using the normal SQL join method.

Is this posible? I can't figure out how to call the record on the custom table for editing from the opportunity workflow. The opportunity is in context so using GetContextInfo doesn't seem to be suitable, there must be a way to call a record from a related entity for editing directly from the workflow buttons?!

Thanks

The SQL goes like this:
 
Opportunity is related to a Custom Table called Residence related by Opportunity.oppo_opportunityid = residence.resi_admissionid where the Opportunity can have 1 or more associated Residences

                                  
1:
2:
3:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-08-28 at 02:44:27ID24689221
Tags

Sage CRM

,

SQL Server 2005

,

SQL

Topics

CRM Software

,

SQL Server 2005

,

SQL Query Syntax

Participating Experts
1
Points
500
Comments
15

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Creating new child entities and linking to Opportunity - Dyn…
    I am looking to create child entities for Opportunities. The purpose of this is to store Documents in a Notes field in the child entities, in order to implement a type of security. I have different groups of users who need to access the Opportunities. But the groups need t...
  2. CRM 4.0 workflows, what am I doing wrong?
    Trying to set up a workflow so when our sales guy sets an opp/project to a 'project' status, it will send an email to the assigned project manager, update many attributes on the opp form, and then assign the opp to the project manager. Attached are screen shots of the workflo...
  3. MS CRM - Workflow query
    Hi, I want to create a workflow query that will increment the number of minutes used by a case - using a workflow trigger on each activity for example the task entiy. When a workflow is created it can update the case used minutes by using the "Regarding (Case)" li...
  4. Workflow CRM
    How do i send a re-occuring email through Microsoft Dynamic CRM 4.0 that can be sent out periodically until there is a seperate trigger (field that is changed) so that the workflow stops and the email is no longer sent out
  5. CRM WorkFlow
    how to integrate CRM workflow with stored procedure in sql 2005 ,, any body have idea?

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: lsavidgePosted on 2009-08-28 at 05:17:09ID: 25206712

Hi,

I'm not sure that what you're planning to do is possible. If you need workflow on a custom entity that will allow you to move that entity through workflow. If you have opportunity workflow on it is not easily possible to force the person to update another entity record because that would require you to step out tof the opportunity workflow and into another entity which would have it's own workflow.

The only possible thing you could do is to have javascript conditions on the following opportunity workflow that make the next step invisible unless a particular (hidden) opportunity field is updated, say with a date. This field can then be updated via the other entity using a tablescript. Once the hidden field is updated on the opportunity, this would then allow the next workflow steps to become visible.

Cheers,

Lee

 

by: TartanTaurusPosted on 2009-08-28 at 05:36:54ID: 25206849

Hi,

I have tried the route of making workfow buttons conditionally visible and I think that is the best solution. But how can I tell the opportunity workflow that the check field in the Residence custom table is Null and therefore the button should be hidden. ( I only want the next button to show if that check field in the Residence table is null)

I can't quite think how I pass that info across!

Thanks

 

by: lsavidgePosted on 2009-08-28 at 05:44:50ID: 25206911

You need to have a field on the opportunity that contains a check value. A date field or something like that. Then you hide the butons on the oppo workflow when this field contains nothing. This means the next workflow buttons do not show until there is a value in that field. In your Residence entity you will need an update tablescript that updates the value in the opportunity with a date when it is updated with the required values. This can be done via a separate workflow on the custom entity or just as simple tablescript. So what happens is that you will need to train the users that when they get to that point in the opportunity workflow, things cannot progress until they update the Residence entity with the required data. When they do that, the tablescript or workflow adds a date into the hidden field on the opportunity which will then allow the next steps to be made visible.

Basically rather than doing things from the oppo workflow, you halt things and wait for the other workflow to "unlock" the oppo workflow by adding the date into that hidden field. This means your visibility check simply checks for the existence of a date in that field. As this date field is not on any screen and is only updated by another workflow, there is no way for the user to move things forward without following the required process.

Some element of user training will be required on this.

Lee

 

by: TartanTaurusPosted on 2009-08-28 at 05:58:59ID: 25207065

Ok I have a significant amount of data on the custom table and it doesn't really require a workflow so what code should I be putting into my update script to put this "lock" into place?

I can call the current context and assign the check field to a variable no problems, I'm just unsure of the code that actually assigns the check data to the hidden field on the opportunity table.

Thanks

 

by: lsavidgePosted on 2009-08-28 at 09:02:22ID: 25209022

Hiya,

First of all, ignore hiding the workflow steps. Concentrate on getting the infrstructure right and then worry about hiding the fields. That bit is cosmetic. First of all you'll need a new field on the opportunity. A text field (1 char in length) will be fine, it really doesn't matter what the field type is as you'll only be looking to see if there is data there or not. The data itself is peripheral.

Then in your tablescript on the Residence entity you will need to have something that runs when the entity is updated. So you'll need something like the script below. This script will run on updates and you'll need to determine your conditions on the Residence that will allow you to update the opportunity. I'll assume that a Residence has a status field and when the status is set to active you will update the opportunity. You will need to put an advanced search select that links to the opportunity on the Residence screen. This will allow you to pick up the oppo ID and pass that to the tablescript.

Once the condition on the Residence is met, it will update the opportunity. Then you need to consider your javascript to hide the workflow buttons based on checking whether that field contains data. For this example I'll assume you have created a 1 char text field. If it contains data, you display the workflow fields otherwise they remain hidden.

Once the function works and updates the opportunity with the value "x" then this bit is working. Then you need to address the hiding of the oppo workflow buttons. We'll do that later.

Cheers,

Lee

function InsertRecord()
{
  // Handle insert record actions here
}
 
function PostInsertRecord()
{
  // Handle post insert record actions here
}
 
function UpdateRecord()
{
  UpdateOpportunity();  // If you want to run this on insert as well, copy this line to the InsertRecord function above.
}
 
function DeleteRecord()
{
  // Handle delete record actions here
}
 
function UpdateOpportunity()
{
  if(resi_status == "active") // Is the status set to "active" - you need to define your conditions here
  {
    oOppo = eWare.FindRecord("opportunity", "oppo_opportunityid=" + Values("resi_opportunityid")); // Look for the oppo
 
    if(!oOppo.EOF) // Did we find it?
    {
      oOppo.oppo_CheckField = "x"; // Set the check field value to something
      oOppo.SaveChanges();  // Save the changes back
    }
  }
}
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:

Select allOpen in new window

 

by: lsavidgePosted on 2009-08-28 at 09:04:10ID: 25209036

This line:

 oOppo = eWare.FindRecord("opportunity", "oppo_opportunityid=" + Values("resi_opportunityid")); // Look for the oppo

should be:

 var oOppo = eWare.FindRecord("opportunity", "oppo_opportunityid=" + Values("resi_opportunityid")); // Look for the oppo

Cheers,

Lee

 

by: lsavidgePosted on 2009-08-28 at 09:04:43ID: 25209043

Oops, and this:

if(resi_status == "active") // Is the status set to "active" - you need to define your conditions here


should be:

if(Values("resi_status") == "active") // Is the status set to "active" - you need to define your conditions here

Lee

 

by: TartanTaurusPosted on 2009-08-28 at 13:49:02ID: 25211434

Hi Lee,

That all makes perfect sense. I will have a crack at that first thing on Monday morning!

Cheers

Chris

 

by: lsavidgePosted on 2009-08-28 at 20:15:02ID: 25212880

I'll be back Tuesday :)

Lee

 

by: TartanTaurusPosted on 2009-09-01 at 04:06:42ID: 25230245

Hi Lee,

No joy I'm afraid! I have set up a checker field on th opportunity entity called oppo_rescheckfield of type "Text" and Length 1. The field used on the residence entity to determine if the record is "active" or not is called resi_residenceend.

The opportunity id is held in the SSA resi_admssionid.

So on updating the residence entity with the field resi_residenceend set to NULL the script does fire as I've had syntax error messages from my typos (now resolved) but the checkerfield isn't updated...

the only thing I can think of is that on the screen where the update takes place the actual SSA resi_admissionid displays a custom reference number, not the oppportunity id. However if I run a SQL select the resi_admissionid field does hold the opportunityid as it should.

Could this be the problem?

Thanks

function InsertRecord()
 
{
UpdateOpportunity()
  // Handle insert record actions here
 
}
 
 
function PostInsertRecord()
 
{
 
  // Handle post insert record actions here
 
}
 
 
function UpdateRecord()
 
{
UpdateOpportunity()
  // Handle update record actions here
 
}
 
 
function DeleteRecord()
 
{
 
  // Handle delete record actions here
 
}
 
function UpdateOpportunity()
{
if(Values("resi_residenceend") = "") // Is the status set to "active" - you need to define your conditions here
  {
    var oOppo = eWare.FindRecord("opportunity", "oppo_opportunityid=" + Values(resi_admissionid)); // Look for the oppo
 
    if(!oOppo.EOF) // Did we find it?
    {
      oOppo.oppo_rescheckfield = "x"; // Set the check field value to something
      oOppo.SaveChanges();  // Save the changes back
    }
  }
}

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:

Select allOpen in new window

 

by: lsavidgePosted on 2009-09-01 at 04:10:20ID: 25230260

This line:

if(Values("resi_residenceend") = "") // Is the status set to "active" - you need to define your conditions here

should be:

if(Values("resi_residenceend") == "") // Is the status set to "active" - you need to define your conditions here

See how that changes things.

Lee

 

by: TartanTaurusPosted on 2009-09-01 at 04:53:13ID: 25230516

Bingo! Sorry about that, I mistyped that bit. That has done the trick.

I have now put conditionals on the buttons in the workflow and all works brilliant. Thanks very much.

One quick query...how would I display a info message on the Oppo Summary screen to notify the user of something. I don't want to use an ErrorStr just a blue bar at the top if that's possible to say that this record is in progress and must be ended to reveal the workflow buttons?

Thanks

 

by: lsavidgePosted on 2009-09-01 at 05:15:10ID: 25230701

There is a way of doing it but it is long winded and requires a technique [sometimes] called the dummy field technique. It requires you to create a dummy 1 char text field and make it readonly. In the create script of the field you hijack the caption element and use that to inject HTML to put in a warning message and you can then set the style elements class to be CLASS=InfoContent. This will give you the blue bar in place of the caption. The field should be the first field on the screen and the second field should have a new line set before it. Then set the dummy field column width to match the number of columns you have on the screen.

See what I mean about being a bit of a pain? You should consider using the errorstr or just slapping the users hard enough until they get it.

Cheers,

Lee

 

by: TartanTaurusPosted on 2009-09-01 at 05:26:03ID: 25230797

Yeah that's a bit long winded. I think I'll go for your final option...should be more enjoyable than hooking up a dummy field ;-)

Thanks for your help on this one, I'll close it off and assign points.

Cheers

Chris

 

by: lsavidgePosted on 2009-09-01 at 05:34:55ID: 25230868

You're welcome.

Lee

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...