Andy in the Cloud

From BBC Basic to Force.com and beyond…

8 thoughts on “Automating the Creation of Flow Screens with Apex Metadata API

  1. Andy,

    These posts are very inspiring and get the creative juices flowing. What do you think about automating the creation of wizards? For example, one enters an account on step 1, one or more opportunities on step 2, and one or more opportunity lines on step 3. How about a flow that creates flows, since flows can call apex, and that are styled some how so they can be used by staff and through sites for customers?

    Code generation like this is one of my favorite things to implement and the possibilities it allows. Thanks for the great work and keep it coming!

    • Yep all great ideas! And I totally agree, “extending” the platform with declarative solution building tools is an awesome way to go!

  2. Pingback: Automating the Creation of Flow Screens with Apex Metadata API | SutoCom Solutions

  3. Hi Andrew, first thanks for the toolkit, it’s awesome. I’m having problems getting a read result form the tool kit when querying for flows though (raised an issue on GitHub) for this https://github.com/financialforcedev/apex-mdapi/issues/162

    I get the list and then after making a list query I use the fullName attribute returned to query for the details of a specific flow. I’m only seeing an empty object. Really strange. I guess I’m doing something wrong, or the response map isn’t correct?

    String[] flowFullNames = new String []{‘Sample_loc’};
    flows = (MetadataService.Flow[]) service.readMetadata(‘Flow’, new List(flowFullNames)).getRecords();

    Result is a returned MetadataService.Flow of one item, except that every attribute is null ! (Note that there is an active flow matching this full name, and that I had to remove the version number to get the metadata api to respond, appending the version number caused an exception, I’ve raised another issue in github for that but it’s less urgent).

    What do you think?

    Thanks!

    Matt

    • Sorry for the late reply, work and life a bit busy at present. This usually happens if the flow name is wrong. It doesn’t give an error just an empty single item. Not ideal I agree. Have you confirmed the flow names via Salesforce Workbench?

  4. Hi Andrew When I run the readmetadata on my Flows I get System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element status

    • Yes it looks like the wrapper needs updating to handle new xml elements. There are notes on the readme on how to do this – I have a side project in mind to create a better tool so the wrapper can stay upto date. Sorry meanwhile – if you invoke your code via anonymous Apex you will see the xml in the debug log – this allows you to tweak the apex class a little to see if you can get it to match. Hope this helps. Andy

  5. I changed the api version to v40.0 logging in and I dont get the error now, but its not returning any flows eg: Flow:[Metadata.fullName=null, actionCalls=null, ……

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s