# Job DSL for multi-branch jobs from Perforce

**URL:** <https://community.jenkins.io/t/job-dsl-for-multi-branch-jobs-from-perforce/14358>\
**Category:** Using Jenkins\
**Created:** [April 18, 2024, 12:43pm UTC](https://community.jenkins.io/t/job-dsl-for-multi-branch-jobs-from-perforce/14358 "2024-04-18T12:43:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![443122919](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/443122919/32/7865_2.png) [@443122919](https://community.jenkins.io/u/443122919)\
**Post date:** [April 18, 2024, 12:43pm UTC](https://community.jenkins.io/t/job-dsl-for-multi-branch-jobs-from-perforce/14358/1 "2024-04-18T12:43:42Z")

</div>

Hi, Jenkins community,

We are trying to translate our job creation into more DSL-driven. However, when I was trying to translate the multi-branch job which is scmed in perforce. I got the following error. Can you please provide me with some idea on what I did wrong?:

```auto
        Processing provided DSL script
        ERROR: java.io.IOException: Failed to persist config.xml
        Finished: FAILURE

```

Here is my DSL script:

```auto
jobs:
  - script: >
      folder('test');
      multibranchPipelineJob('my-build') {
        factory {
            workflowBranchProjectFactory {
                scriptPath('Build/Jenkinsfile/ManualTask.Jenkinsfile')
            }
        }
        branchSources {
          branchSource {
            source {
              configure { node ->
                def p4source = node / 'source'
                p4source / '@class'('org.jenkinsci.plugins.p4.scm.BranchesScmSource')
                p4source / 'credential'('P4_Credential')
                p4source / 'includes'('//some/path')
                p4source / 'charset'('none')
                p4source / 'format'('jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}')
                
                // Now, we define the populate strategy
                def populate = p4source / 'populate'
                populate / '@class'('org.jenkinsci.plugins.p4.populate.CheckOnlyImpl')
                populate / 'have'(false)
                populate / 'force'(false)
                populate / 'modtime'(false)
                populate / 'quiet'(true)
              }
            }
          }
        }
        orphanedItemStrategy {
          discardOldItems {
              daysToKeep(-1)
              numToKeep(-1)
          }
        }
        triggers {
            periodicFolderTrigger{
              interval('H/5 * * * *')
            }
        }
      }

```
