Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflow elements do not extend metadata class #19

Closed
swhalen123 opened this issue Feb 26, 2014 · 2 comments
Closed

workflow elements do not extend metadata class #19

swhalen123 opened this issue Feb 26, 2014 · 2 comments

Comments

@swhalen123
Copy link

Hi,
I am trying to create "workflow" metadata via the wrapper. I'm having trouble adding the "fullName" attribute to the parent workflow and its child elements

code like this:
((MetadataService.metadata)myWorkflow).fullName = source.subject;
produces this error:
Error: Compile Error: Incompatible types since an instance of MetadataService.Workflow is never an instance of MetadataService.Metadata at line xyz

The attempt to create workflow fails with a similar type error.
MetadataService.AsyncResult[] results = service.create(new List<MetadataService.Metadata> { myWorkflow});

that line fails with an error saying that the method is expecting a metadata object.

@afawcett
Copy link
Contributor

afawcett commented Mar 1, 2014

I have added support for the Workflow metadata types, take a look at the latest MetadataService.cls. Your code will now compile. Keep in mind as per the blog post linked in the read me the handling of AsyncResult.

Also keep in mind the following...

  • Workflow metadata type is a container for all WorkflowAlert, WorkflowFieldUpdate, WorkflowKnowledgePublish, WorkflowOutboundMessage, WorkflowRule, WorkflowSend and WorkflowTask meta data types associated with a given object. This metadata type only works with the 'deploy' and 'retrieve' operations (see Salesforce Metadata API documentation).
  • WorkflowRule metadata type defines a specific rule and the workflow actions (defined via separate calls to create) linked with it via the WorkflowActionReference type.This metadata type can be used with the 'create' method. Though you must have already created the workflow actions it references.

Depending on how complex a Workflow Rule you want to create you may want to wait for the Spring'14 rollout and for me to update this library. Since this version of the API will support an immediate version of the 'create' operation which does not require you to handle the AsyncResult (as per the blog linked in the readme). In this case, you can issue one create call after another to create your required actions and then finally a Workflow Rule to link them together.

That said if your still in a rush, i can try and do you an example using the existing 'create' method. If you let me know the minimal example you would need in terms of the type of workflow actions your use case needs. If your not in a rush, i will do an example using the new 'create' method sometime mid-March once the platform release has completed it's rollout.

@afawcett afawcett closed this as completed Mar 1, 2014
@swhalen123
Copy link
Author

Thanks Andrew, your library has been a big help. We're going to go foreward with the library the series of calls (for the WorkflowTask and WorkflowRule), with some polling of the asyncResponse in the middle. This is working for us on a small scale now. I am going to experiment today with using the "MetadataCreateJob" library to manage the dependent objects. In our case we'll have about 100 pairs of Tasks and Rules; I'll see how that volume fits into the list of Items that are bundled together.
thanks very much for your quick response on this!
Sean

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants