You need to sign in to do that
Don't have an account?
Created Flow using Metadata API but unable to see it in Salesforce
Hi I have created a flow using following code
MetadataService.MetadataPort service = createService();
MetadataService.Flow flow = new MetadataService.Flow();
flow.fullName = 'My_Flow-1';
flow.label = 'My Flow';
flow.description= 'This is a test floe';
flow.metaType='Flow';
//flow.type_x='';
MetadataService.FlowStep step = new MetadataService.FlowStep();
//step.metaType = 'FlowStep';
step.label='mylabel';
step.locationX=100;
step.locationY = 10;
step.description = 'Step description';
step.name='test step';
//MetadataService.AsyncResult[] results2 = service.create(new MetadataService.FlowStep[] { step });
flow.steps = new MetadataService.FlowStep[]{step};
//MetadataService.AsyncResult[] results = service.create(new List<MetadataService.Metadata> { flow });
MetadataService.AsyncResult[] results = service.create(new MetadataService.Flow[] { flow });
I get an id like 04sd0000002iQXvAAM in AsyncResult. But I am unable to see the flow in Salesforce.
2ndly, Can you also tell me how do i get the id with which I can access the flow using url like https://na14.salesforce.com/04sd0000002iQXvAAM
Thanks
Amit
I have modified my code like this..
MetadataService.MetadataPort service = createService();
MetadataService.Flow flow = new MetadataService.Flow();
flow.fullName = 'My_Flow-1';
flow.label = 'My Flow';
flow.description= 'This is a test floe';
flow.metaType='Flow';
//flow.type_x='';
MetadataService.FlowStep step = new MetadataService.FlowStep();
//step.metaType = 'FlowStep';
step.label='mylabel';
step.locationX=100;
step.locationY = 10;
step.description = 'Step description';
step.name='test step';
//MetadataService.AsyncResult[] results2 = service.create(new MetadataService.FlowStep[] { step });
flow.steps = new MetadataService.FlowStep[]{step};
//MetadataService.AsyncResult[] results = service.create(new List<MetadataService.Metadata> { flow });
MetadataService.AsyncResult[] results = service.create(new MetadataService.Flow[] { flow });
do{
results = service.checkStatus(new String[] { results[0].id });
}while(!results[0].done);
System.debug('message================='+results[0].message);
return results[0].id+'?message='+results[0].message+'&statusCode='+results[0].statusCode;
No I am geeting a message like "
An unexpected error occurred. Please include this ErrorId if you contact support: 1460987326-60726 (-727292666)".
Any help will be highly appreciated.
Hi,
I am able to see the Flow in the Salesforce now. But issue is that in the AsynchResult I am getting the object id as 04sd0000002iUccAAE. But when I open the Flow in the Salesforce I see the URL as https://na14.salesforce.com/300d0000000PpiI. My question is how do I get this id (300d0000000PpiI) in my Apex code.
Thanks
Amit