Can you please help me in creating the dsl script for a pipeline job which has got the property - Build after other projects are built. Let the other project be Project A
You need to use upstream
API of Jenkins Job DSL.
Please look into this for a sample example:
https://jenkinsci.github.io/job-dsl-plugin/#path/job-triggers-upstream