public static Map<String,Object> createOrderNote(DispatchContext dctx,Map<String,? extends Object> context){
  Delegator delegator=dctx.getDelegator();
  LocalDispatcher dispatcher=dctx.getDispatcher();
  GenericValue userLogin=(GenericValue)context.get("userLogin");
  String noteString=(String)context.get("note");
  String noteName=(String)context.get("noteName");
  String orderId=(String)context.get("orderId");
  String internalNote=(String)context.get("internalNote");
  Map<String,Object> noteCtx=UtilMisc.<String,Object>toMap("note",noteString,"userLogin",userLogin,"noteName",noteName);
  Locale locale=(Locale)context.get("locale");
  try {
    Map<String,Object> noteRes=dispatcher.runSync("createNote",noteCtx);
    if (ServiceUtil.isError(noteRes))     return noteRes;
    String noteId=(String)noteRes.get("noteId");
    if (UtilValidate.isEmpty(noteId)) {
      return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderProblemCreatingTheNoteNoNoteIdReturned",locale));
    }
    Map<String,String> fields=UtilMisc.<String,String>toMap("orderId",orderId,"noteId",noteId,"internalNote",internalNote);
    GenericValue v=delegator.makeValue("OrderHeaderNote",fields);
    delegator.create(v);
  }
 catch (  GenericEntityException ee) {
    Debug.logError(ee,module);
    return ServiceUtil.returnError(UtilProperties.getMessage(resource,"OrderOrderNoteCannotBeCreated",UtilMisc.toMap("errorString",ee.getMessage()),locale));
  }
catch (  GenericServiceException se) {
    Debug.logError(se,module);
    return ServiceUtil.returnError(UtilProperties.getMessage(resource,"OrderOrderNoteCannotBeCreated",UtilMisc.toMap("errorString",se.getMessage()),locale));
  }
  return ServiceUtil.returnSuccess();
}

public static Map < String , Object > createOrderNote ( DispatchContext dctx , Map < String , ? extends Object > context ) { Delegator delegator = dctx . getDelegator ( ) ; LocalDispatcher dispatcher = dctx . getDispatcher ( ) ; GenericValue userLogin = ( GenericValue ) context . get ( "userLogin" ) ; String noteString = ( String ) context . get ( "note" ) ; String noteName = ( String ) context . get ( "noteName" ) ; String orderId = ( String ) context . get ( "orderId" ) ; String internalNote = ( String ) context . get ( "internalNote" ) ; Map < String , Object > noteCtx = UtilMisc . < String , Object > toMap ( "note" , noteString , "userLogin" , userLogin , "noteName" , noteName ) ; Locale locale = ( Locale ) context . get ( "locale" ) ; try { Map < String , Object > noteRes = dispatcher . runSync ( "createNote" , noteCtx ) ; if ( ServiceUtil . isError ( noteRes ) ) return noteRes ; String noteId = ( String ) noteRes . get ( "noteId" ) ; if ( UtilValidate . isEmpty ( noteId ) ) { return ServiceUtil . returnError ( UtilProperties . getMessage ( resource_error , "OrderProblemCreatingTheNoteNoNoteIdReturned" , locale ) ) ; } Map < String , String > fields = UtilMisc . < String , String > toMap ( "orderId" , orderId , "noteId" , noteId , "internalNote" , internalNote ) ; GenericValue v = delegator . makeValue ( "OrderHeaderNote" , fields ) ; delegator . create ( v ) ; } catch ( GenericEntityException ee ) { Debug . logError ( ee , module ) ; return ServiceUtil . returnError ( UtilProperties . getMessage ( resource , "OrderOrderNoteCannotBeCreated" , UtilMisc . toMap ( "errorString" , ee . getMessage ( ) ) , locale ) ) ; } catch ( GenericServiceException se ) { Debug . logError ( se , module ) ; return ServiceUtil . returnError ( UtilProperties . getMessage ( resource , "OrderOrderNoteCannotBeCreated" , UtilMisc . toMap ( "errorString" , se . getMessage ( ) ) , locale ) ) ; } return ServiceUtil . returnSuccess ( ) ; }
service to create a order header note .
